redis-trib.rb改redis-cli

好像是5.0以上推荐使用redis-cli。

 

脚本redis-trib.rb创建集群:

[root@localhost src]#  ./redis-trib.rb create --replicas 1 192.168.220.3:7001  192.168.220.3:7002  192.168.220.3:7003  192.168.220.3:7004  192.168.220.3:7005  192.168.220.3:7006
WARNING: redis-trib.rb is not longer available!
You should use redis-cli instead.

All commands and features belonging to redis-trib.rb have been moved
to redis-cli.
In order to use them you should call redis-cli with the --cluster
option followed by the subcommand name, arguments and options.

Use the following syntax:
redis-cli --cluster SUBCOMMAND [ARGUMENTS] [OPTIONS]

Example:
redis-cli --cluster create 192.168.220.3:7001 192.168.220.3:7002 192.168.220.3:7003 192.168.220.3:7004 192.168.220.3:7005 192.168.220.3:7006 --cluster-replicas 1

To get help about all subcommands, type:
redis-cli --cluster help

$mc:我使用redis_version:5.0.4版本。出现这情况。代码块上不了颜色,将就看一下咯。

 

输入Example:

[root@localhost src]# redis-cli --cluster create 192.168.220.3:7001 192.168.220.3:7002 192.168.220.3:7003 192.168.220.3:7004 192.168.220.3:7005 192.168.220.3:7006 --cluster-replicas 1
[ERR] Node 192.168.220.3:7001 NOAUTH Authentication required.

$.mc:提示我节点需要输入密码

 

输入密码认证:-a

[root@localhost src]# redis-cli --cluster create --cluster-replicas 1 192.168.220.3:7001 192.168.220.3:7002 192.168.220.3:7003 192.168.220.3:7004 192.168.220.3:7005 192.168.220.3:7006 -a 1234

执行结果:

[root@localhost src]# redis-cli --cluster create --cluster-replicas 1 192.168.220.3:7001 192.168.220.3:7002 192.168.220.3:7003 192.168.220.3:7004 192.168.220.3:7005 192.168.220.3:7006 -a 1234
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
>>> Performing hash slots allocation on 6 nodes...
Master[0] -> Slots 0 - 5460
Master[1] -> Slots 5461 - 10922
Master[2] -> Slots 10923 - 16383
Adding replica 192.168.220.3:7005 to 192.168.220.3:7001
Adding replica 192.168.220.3:7006 to 192.168.220.3:7002
Adding replica 192.168.220.3:7004 to 192.168.220.3:7003
>>> Trying to optimize slaves allocation for anti-affinity
[WARNING] Some slaves are in the same host as their master
M: 5bb0d92b3d6d7da20dbd4443f2a847d50aaf08d1 192.168.220.3:7001
   slots:[0-5460] (5461 slots) master
M: 8a66470a2e711a6fb6869b663914a74da220da35 192.168.220.3:7002
   slots:[5461-10922] (5462 slots) master
M: 7da4efa055bf56926474b657128fb53049dbdfc0 192.168.220.3:7003
   slots:[10923-16383] (5461 slots) master
S: 076e011651747b1b0a1f6622397b191fe1278799 192.168.220.3:7004
   replicates 5bb0d92b3d6d7da20dbd4443f2a847d50aaf08d1
S: c966400281a41a2a9849b0bce89b8c0a8dab1b70 192.168.220.3:7005
   replicates 8a66470a2e711a6fb6869b663914a74da220da35
S: 4d306efd1be998bbaaadd441263dfc4f9463dbb5 192.168.220.3:7006
   replicates 7da4efa055bf56926474b657128fb53049dbdfc0
Can I set the above configuration? (type 'yes' to accept): ^C
[root@localhost src]# redis-cli --cluster create --cluster-replicas 1 192.168.220.3:7001 192.168.220.3:7002 192.168.220.3:7003 192.168.220.3:7004 192.168.220.3:7005 192.168.220.3:7006 -a 1234
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
>>> Performing hash slots allocation on 6 nodes...
Master[0] -> Slots 0 - 5460
Master[1] -> Slots 5461 - 10922
Master[2] -> Slots 10923 - 16383
Adding replica 192.168.220.3:7005 to 192.168.220.3:7001
Adding replica 192.168.220.3:7006 to 192.168.220.3:7002
Adding replica 192.168.220.3:7004 to 192.168.220.3:7003
>>> Trying to optimize slaves allocation for anti-affinity
[WARNING] Some slaves are in the same host as their master
M: 5bb0d92b3d6d7da20dbd4443f2a847d50aaf08d1 192.168.220.3:7001
   slots:[0-5460] (5461 slots) master
M: 8a66470a2e711a6fb6869b663914a74da220da35 192.168.220.3:7002
   slots:[5461-10922] (5462 slots) master
M: 7da4efa055bf56926474b657128fb53049dbdfc0 192.168.220.3:7003
   slots:[10923-16383] (5461 slots) master
S: 076e011651747b1b0a1f6622397b191fe1278799 192.168.220.3:7004
   replicates 5bb0d92b3d6d7da20dbd4443f2a847d50aaf08d1
S: c966400281a41a2a9849b0bce89b8c0a8dab1b70 192.168.220.3:7005
   replicates 8a66470a2e711a6fb6869b663914a74da220da35
S: 4d306efd1be998bbaaadd441263dfc4f9463dbb5 192.168.220.3:7006
   replicates 7da4efa055bf56926474b657128fb53049dbdfc0
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.220.3:7001)
M: 5bb0d92b3d6d7da20dbd4443f2a847d50aaf08d1 192.168.220.3:7001
   slots:[0-5460] (5461 slots) master
   1 additional replica(s)
M: 8a66470a2e711a6fb6869b663914a74da220da35 192.168.220.3:7002
   slots:[5461-10922] (5462 slots) master
   1 additional replica(s)
S: 4d306efd1be998bbaaadd441263dfc4f9463dbb5 192.168.220.3:7006
   slots: (0 slots) slave
   replicates 7da4efa055bf56926474b657128fb53049dbdfc0
S: 076e011651747b1b0a1f6622397b191fe1278799 192.168.220.3:7004
   slots: (0 slots) slave
   replicates 5bb0d92b3d6d7da20dbd4443f2a847d50aaf08d1
S: c966400281a41a2a9849b0bce89b8c0a8dab1b70 192.168.220.3:7005
   slots: (0 slots) slave
   replicates 8a66470a2e711a6fb6869b663914a74da220da35
M: 7da4efa055bf56926474b657128fb53049dbdfc0 192.168.220.3:7003
   slots:[10923-16383] (5461 slots) master
   1 additional replica(s)
[OK] All nodes agree about slots configuration.
>>> Check for open slots...
>>> Check slots coverage...
[OK] All 16384 slots covered.
[root@localhost src]# 

 

你可能感兴趣的:(redis)