1. 下载源码
wget http://download.redis.io/releases/redis-3.0.7.tar.gz
解压缩编译
cd redis-3.0.7
cd src
make
sudo make PREFIX=/usr/local/redis-2.4.4 install
修改用户的.bashrc
PATH变量增加/usr/local/redis-2.4.4/bin"
simomme@sud1:/usr/local/redis-2.4.4/bin$ sudo cp ~/002.tool/redis-3.0.7/redis.conf ./
修改配置文件,将其中的"daemonize no"行改为"daemonize yes",让其在后台运行。
redis-server /usr/local/redis-2.4.4/bin/redis.conf
sudo apt-get install ruby
./redis-trib.rb:24:in `require': no such file to load -- rubygems (LoadError)
from ./redis-trib.rb:24
sudo apt-get install rubygems
gem install redis
simomme@sud1:~/002.tool/redis-3.0.7/src$ sudo gem install redis
Fetching: redis-3.2.2.gem (100%)
Successfully installed redis-3.2.2
1 gem installed
Installing ri documentation for redis-3.2.2...
Installing RDoc documentation for redis-3.2.2...
可能需要翻墙
simomme@sud1:~/002.tool/redis-3.0.7/src$ ./redis-trib.rb
simomme@sud1:~/002.tool/redis-3.0.7/src$ ./redis-trib.rb create 192.168.3.116:6379
>>> Creating cluster
[ERR] Node 192.168.3.116:6379 is not configured as a cluster node.
redis-cli -h 127.0.0.1 -p 6379 shutdown
redis-trib.rb create 192.168.3.116:6379 192.168.3.116:6380 192.168.3.116:6382
>>> Creating cluster
>>> Performing hash slots allocation on 3 nodes...
Using 3 masters:
192.168.3.116:6379
192.168.3.116:6380
192.168.3.116:6382
M: e9e8c93046b5fe35efa951ad3989baeedf668917 192.168.3.116:6379
slots:0-5460 (5461 slots) master
M: d388b7dfa14e372faa44a884f39671d6ee3ccf44 192.168.3.116:6380
slots:5461-10922 (5462 slots) master
M: 464d29661eed93cda7a72a29cb8c54fad04ea186 192.168.3.116:6382
slots:10923-16383 (5461 slots) master
Can I set the above configuration? (type 'yes' to accept): yes
>>> Nodes configuration updated
>>> Assign a different config epoch to each node
>>> Sending CLUSTER MEET messages to join the cluster
Waiting for the cluster to join..
>>> Performing Cluster Check (using node 192.168.3.116:6379)
M: e9e8c93046b5fe35efa951ad3989baeedf668917 192.168.3.116:6379
slots:0-5460 (5461 slots) master
M: d388b7dfa14e372faa44a884f39671d6ee3ccf44 192.168.3.116:6380
slots:5461-10922 (5462 slots) master
M: 464d29661eed93cda7a72a29cb8c54fad04ea186 192.168.3.116:6382
slots:10923-16383 (5461 slots) master
[OK] All nodes agree about slots configuration.
>>> Check for open slots...
>>> Check slots coverage...
[OK] All 16384 slots covered.
redis-cli -h 127.0.0.1 -p 6379 shutdown
redis-cli -h 127.0.0.1 -p 6380 shutdown
redis-cli -h 127.0.0.1 -p 6382 shutdown
redis-server ~/011.redis/ins01/redis.conf
redis-server ~/011.redis/ins02/redis.conf
redis-server ~/011.redis/ins03/redis.conf
ps -ef|grep "redis"
配置文件注意两个
1个是db 一个是node.conf
nodes-6380.conf
3台机器 每台两个实例