注册 登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

阿弥陀佛

街树飘影未见尘 潭月潜水了无声 般若观照心空静...

 
 
 

日志

 
 
关于我

一直从事气象预报、服务建模实践应用。 注重气象物理场、实况场、地理信息、本体知识库、分布式气象内容管理系统建立。 对Barnes客观分析, 小波,计算神经网络、信任传播、贝叶斯推理、专家系统、网络本体语言有一定体会。 一直使用Java、Delphi、Prolog、SQL编程。

网易考拉推荐

Centos6.3 Install Riak 1.4.2  

2013-11-14 19:43:29|  分类: Akka |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |

How To Create a Riak Cluster on an Ubuntu VPS


0. 添加riak账号
visudo
add one with your username below that
riak ALL=(ALL) ALL

查询当前终端的文件句柄数: ulimit -n 回车,一般的系统默认的1024.
将ulimit 加入到/etc/profile 文件底部
echo ulimit -n 65535 >>/etc/profile
source /etc/profile    #加载修改后的profile

also can do with :
sudo vi /etc/security/limits.conf
*               soft     nofile          65536
*               hard     nofile          65536
ulimit -a

1. 安装
yum install http://yum.basho.com/gpg/basho-release-6-1.noarch.rpm
yum install riak

2. 启动
参见:Post Installation: for checking Riak health after installation
riak start
riak ping
riak-admin test
curl -v http://127.0.0.1:8098/riak/test
 HTTP/1.1 200 OK

riak-admin diag
Data directory /var/lib/riak/bitcask is not mounted with 'noatime'.

riak stop
cd /etc/riak
nano app.config
将127.0.0.1换为 本机IP地址
{pb, [ {"Your.IP.Address", 8087 } ]},
{http, [ {"Your.IP.Address", 8098 } ]},

nano vm.args
将127.0.0.1换为 本机IP地址
3. 建立集群(Cluster)
在第二节点上加入第一节点到集群:
riak-admin cluster join riak@First.Riak.IP
Success: staged join request for 'riak@Second.Riak.IP' to 'riak@1First.Riak.IP'

This will set up the action of joining, but it will not execute yet. We must view the planned changes first: riak-admin cluster plan
This will show you the results of the planned change. Riak makes you view the purposed changes before it executes the action.

If the proposal looks correct, commit the changes: riak-admin cluster commit Cluster changes committed
We can see the new cluster group by typing: riak-admin member-status
Repeat the procedure for the other nodes to form a full cluster group.
4. 优化

Now that we are set up, it is important that we go back and fix some settings that are not ideal for our purposes.

One thing we need to change is the "ulimit" setting that we were warned about when starting Riak. We will create a file to permanently change this setting:
nano /etc/default/riak

Add the following line, which will be executed when the computer starts Riak each time:
ulimit -n 65536

Save and close the file.

Next, we need to see what Riak thinks we should optimize:
riak-admin diag
[critical] vm.swappiness is 60, should be no more than 0
[critical] net.core.wmem_default is 229376, should be at least 8388608
[critical] net.core.rmem_default is 229376, should be at least 8388608
[critical] net.core.netdev_max_backlog is 1000, should be at least 10000
[critical] net.core.somaxconn is 128, should be at least 4000
[critical] net.ipv4.tcp_max_syn_backlog is 2048, should be at least 40000
[critical] net.ipv4.tcp_fin_timeout is 60, should be no more than 15
[critical] net.ipv4.tcp_tw_reuse is 0, should be 1
[notice] Data directory /var/lib/riak/bitcask is not mounted with 'noatime'. Please remount its disk with the 'noatime' flag to improve performance.

There is a chance that you will also see a large list of messages, the first of which starts with:
[warning] The following preflists do not satisfy the n_val:

This means that your cluster does not have enough nodes to correctly spread our data out. If we join more nodes to our cluster, these messages will disappear.

We will work on adjusting all of the "critical" notices. They can all be adjusted like this:
sysctl setting=value

Each command will depend on the output of the "riak-admin diag" program, but will follow the same format.

Re-run the diagnostic command to see if the values are fixed:
riak-admin diag
[notice] Data directory /var/lib/riak/bitcask is not mounted with 'noatime'. Please remount its disk with the 'noatime' flag to improve performance.

We safely can ignore the notice message. Our new values have fixed the issues with our node.

These values will only exist for the current session. To make the values persist, we need to edit the "sysctl.conf" file:
nano /etc/sysctl.conf

Search for each of the different keys and adjust the values as suggested by the "riak-admin diag" command. If the settings don't exist, add them to the bottom of the list.
setting=value

Our node is now configured correctly. Repeat the above steps on each machine to continue.

Testing the Cluster


We can add a file to test our cluster easily. First, get an image you'd like to use. We will use an image off of the DigitalOcean website:
cd ~
wget https://www.digitalocean.com/assets/v2/footer_mascott.png

Now we can put the image into our cluster with the following command.

Replace the IP command with your node's IP address and the port with the http port from the "/etc/riak/app.config" file. By default, it should be "8098":
curl -XPUT http://IPAddress:Port/riak/images/sammy.png -H "Content-type: image/png" --data-binary @footer_mascott.png

Now, you should be able to see your image by pointing your browser to the url from the command:
http://IPAddress:Port/riak/images/sammy.png

You should be able to see the image.



3. Five Minute Install : a guide that will show you how to go from one node to bigger than Google!

Usage: riak {start|stop|restart|reboot|ping|console|\
             attach|chkconfig|escript|version}

Usage: riak-admin { cluster | join | leave | backup | restore | test | reip | js-reload | erl-reload | wait-for-service | ringready | transfers | force-remove | down | cluster-info | member-status | ring-status | vnode-status | diag | status | transfer-limit | top [-interval N] [-sort reductions|memory|msg_q] [-lines N] }
http://littleriakbook.com/
  评论这张
 
阅读(710)| 评论(0)
推荐 转载

历史上的今天

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2017