NginX and Riak

网友投稿 604 2023-02-14

本站部分文章、图片属于网络上可搜索到的公开信息,均用于学习和交流用途,不能代表睿象云的观点、立场或意见。我们接受网民的监督,如发现任何违法内容或侵犯了您的权益,请第一时间联系小编邮箱jiasou666@gmail.com 处理。

NginX and Riak

Problem of storage and delivering static content is quiet actual nowadays. Lots of people needs big and reliable storages for storing static images and many other static files and delivering it to end users. Most popular solution still is NFS mounted storage, which is accessible from all front-ends, but this solution has big bottlenecks.

Hard to backup.Everything relies on NAS.Statically mounted external storage is needed.

Now lets dig deeper:

Hard to Backup :Some of you will say that this is not so ! But lets imagine that you have 10TB of small images which your application regularly use and this images are very critical. Standard rsync and or tar could take lots of time and system resources, which is definitely not what we want.

Statically mounted external storage is needed: This means that all your system will rely on externally mounted device and regardless how reliable is that, it is some king of SPOF.

So for everyone else:

lets summarize what we need:

Reliable storage.Low latency to access file.Easy management and backup.Reliability and fault tolerance.Easy access and less programming overhead.

After spending lots of time for finding a solution for mentioned problems we found seems ideal solution:

Before starting let’s summarize what these two tools will give us:

Download and Install Riak:

Done! Riak is installed. Do not start it for now. Just in case:

1
# /etc/init.d/riak restart

edit /etc/riak/app.config and change:

Also make sure you have configured /etc/hosts file and system hostname. Correct /etc/hosts should look something like this:

Also make sure you have configured /etc/hosts file and system hostname. Correct /etc/hosts should look something like this:

Also if you do not have your own internal DNS, you will have to add other nodes to /etc/hosts as well, but better to have DNS.

Also make some changes for storage configuration:

format and mount your bid disk to /var/lib/riak:

1
2
3
4
5
6
# mkfs.xfs /dev/sdb1
# mount /dev/sdb1 /mnt
# mv /var/lib/riak/* /mnt/
# umount /mnt
# mount /dev/sdb1 /var/lib/riak
# chown -R riak.riak /var/lib/riak

Or better just create another mount-point and reconfigure Riak to use it

1
2
3
4
# mount /dev/sdb1 /opt
# mkdir /opt/riak
# chown riak.riak /opt/riak
# mv /var/lib/riak/* /opt/riak

Change paths in /etc/riak/app.config:

1
2
3
4
5
{riak_core,[
{ring_state_dir,"/opt/riak/riak/ring"},
...--------...
{bitcask,[{data_root,"/opt/riak/bitcask"}]},
{eleveldb,[{data_root,"/opt/riak/leveldb"}]},

Also it would be nice to enable Riak console to have nice WUI

It is installed by default so all you need is to change userlist from {userlist, [{"user", "pass"} to actual values. and make sure {admin, true} exist.

also edit /etc.riak/vm.args and change

Now restart Riak:

1
/etc/init.d/riak restart

Nor we need to more nodes to have redundancy: lets imagine that we have 3 nodes cluster for now.

Now you have 3 separate nodes, now need to join them all to single cluster: Very nice guide to do this is here

Shortly you need yo do following: After making apropriate configs

on node 2 and 3

And only on riak1 node

Now you have fully clusterized and working Riak installation.

to test is do following:

apt-get install nginx

Now edit /etc/nginx/sites-enabled/default and replace content with this:

上一篇:包含it运维师前途的词条
下一篇:消防主机自动告警怎么处理(消防主机报警如何处理)
相关文章

 发表评论

暂时没有评论,来抢沙发吧~