redis集羣維護:
一、啓動100\101上的6個節點
主機 192.168.199.101
cd /home/redis-cluster/nodes-7001/ , 執行: nohup /home/redis-4.0.14/src/redis-server ./redis.conf &
cd /home/redis-cluster/nodes-7002/ , 執行:nohup /home/redis-4.0.14/src/redis-server ./redis.conf &
cd /home/redis-cluster/nodes-7003/ , 執行:nohup /home/redis-4.0.14/src/redis-server ./redis.conf &
主機 192.168.199.100
cd /home/redis-cluster/nodes-7001/ ,執行: nohup /home/redis-4.0.14/src/redis-server ./redis.conf &
cd /home/redis-cluster/nodes-7002/ ,執行:nohup /home/redis-4.0.14/src/redis-server ./redis.conf &
cd /home/redis-cluster/nodes-7003/ ,執行:nohup /home/redis-4.0.14/src/redis-server ./redis.conf &
二、啓動redis集羣(注意命令寫在一樣,不要換行)
./redis-trib.rb create --replicas 1 192.168.199.101:7001 192.168.199.101:7002 192.168.199.101:7003 192.168.199.100:7001 192.168.199.100:7002 192.168.199.100:7003
如啓動報錯:Node 192.168.199.101:7001 is not empty.
Either the node already knows other nodes (check with CLUSTER NODES) or contains some key in database 0
解決方案:
1、將每個節點下aof、rdb、nodes.conf本地備份文件刪除;
2、172.168.63.201:7001> flushdb #清空當前數據庫(可省略)
3、之後再執行腳本,成功執行;
參考: https://blog.csdn.net/wudalang_gd/article/details/52153571