1. 删除nodes.conf
2. 修改redis.conf,增加或打开requirepass 后面跟上密码:
requirepass yourpassword
3. 使用find / -name client.rb 找到redis的该文件,编辑,增加密码:
DEFAULTS = {
:url => lambda { ENV["REDIS_URL"] },
:scheme => "redis",
:host => "127.0.0.1",
:port => 6379,
:path => nil,
:timeout => 5.0,
:password => "xxxxxx",
:db => 0,
:driver => nil,
:id => nil,
:tcp_keepalive => 0,
:reconnect_attempts => 1,
:inherit_socket => false
}
不遵循此步骤对应的异常:[ERR] Sorry, can't connect to node 10.26.28.31:7001
4. find / -name appendonly.aof,dumm.rdb,node.conf,删除每个节点下的这些文件
不遵循此步骤对应的异常:[ERR] Node 10.26.28.31:7001 is not empty. Either the node already knows other nodes (check with CLUSTER NODES) or contains some key in database 0.
5. 使用命令创建集群: ./redis-trib.rb create --replicas 1 ip1:7001 ip2:7002 ip3:7001 ip4:7002 ip5:7001 ip6:7002