redis-trib.rb: command not found

问题:

在配置redis的时候执行:

lilongjiu@bogon:~/redis/redis-3.0.7/src$ ./redis-trib.rb create --replicas 0 127.0.0.1:9001 127.0.0.1:9002 127.0.0.1:9003

报错:

redis-trib.rb: command not found


解决方法:

1.安装ruby:

lilongjiu@bogon:~/redis/redis-3.0.7/src$ sudo apt-get install ruby 

2.安装完查看ruby版本:

lilongjiu@bogon:~/redis/redis-3.0.7/src$ ruby -v
ruby 1.9.3p194 (2012-04-20 revision 35410) [i686-linux]

3.安装redis的gem

root@bogon:/home/lilongjiu/redis/redis-3.0.7# 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...

4. 执行:

lilongjiu@bogon:~/redis/redis-3.0.7/src$ ./redis-trib.rb create --replicas 0 127.0.0.1:9001 127.0.0.1:9002 127.0.0.1:9003
>>> Creating cluster
>>> Performing hash slots allocation on 3 nodes...
Using 3 masters:
127.0.0.1:9001
127.0.0.1:9002
127.0.0.1:9003
M: f8ff9e46f2f273dff80c6208267b663b0f48f854 127.0.0.1:9001
   slots:0-5460 (5461 slots) master
M: b690db21152874a96cc0d61b9b8ad796d7b64bbc 127.0.0.1:9002
   slots:5461-10922 (5462 slots) master
M: 88c80a887288254facc1fbb496ce8eab26ad0e31 127.0.0.1:9003
   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 127.0.0.1:9001)
M: f8ff9e46f2f273dff80c6208267b663b0f48f854 127.0.0.1:9001
   slots:0-5460 (5461 slots) master
M: b690db21152874a96cc0d61b9b8ad796d7b64bbc 127.0.0.1:9002
   slots:5461-10922 (5462 slots) master
M: 88c80a887288254facc1fbb496ce8eab26ad0e31 127.0.0.1:9003
   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.

成功



你可能感兴趣的:(other)