codis codis-ha主从切换后服务器标记为offline,主要基于数据安全考虑,此时需要人工操作恢复主从关系
在offline的节点执行添加到组群命令,执行后offline的主机会重新与同组的master主机建立关系.





[codis@192_168_171_137 sample]$ ../bin/codis-config -c config.ini -L ./log/cconfig.log server add 4 192.168.171.140:6381 slave
    {
      "msg": "OK",
      "ret": 0
    }



启动

nohup ../bin/codis-server ./redis_conf/6381.conf &> ./log/redis_6381.log &
nohup ../bin/codis-server ./redis_conf/6382.conf &> ./log/redis_6382.log &


删除某一组

../bin/codis-config -c config.ini -L ./log/config.log server remove-group 4

某一台主机

 ../bin/codis-config -c config.ini -L ./log/cconfig.log server promote 1 192.168.174.135:6381
 ../bin/codis-config -c config.ini -L ./log/cconfig.log server promote 2 192.168.174.136:6381
 ../bin/codis-config -c config.ini -L ./log/cconfig.log server remove 1 192.168.174.135:6381
 ../bin/codis-config -c config.ini -L ./log/cconfig.log server remove 2 192.168.174.136:6381


./codis-ha --codis-config=192.168.171.135:18087 --productName=redis_cluster1 &