最关键的问题是,IP地址已经变化,对于sentinel怎么办
持久化是作为缓存服务器使用的。如果只用于数据的缓存,那么可以关闭数据持久化;如果要是需要数据保存在硬盘上,那么开启数据持久化
redis初始化安装(通过install_server脚本)
yum -y install glibc-kernheaders
cd ./utils/目录,运行install_server脚本
vim /etc/redis/redis_6379.conf
/etc/init.d/redis_6379 start/stop
master与slave端vim /etc/redis_redis_6379
slave端:vim /etc/redis/redis_6379
设置slaveof <masterip> <masterport>
cp redis-3.2.3/sentinel.conf /etc/redis/
logfile "/var/log/sentinel_log.log"
redis-sentinel /etc/redis/sentinel.conf
sentinel monitor mymaster 10.10.0.5 6379 2
sentinel down-after-milliseconds mymaster 5000
sentinel failover-timeout mymaster 180000
sentinel parallel-syncs mymaster 1
cp redis-trib.rb /usr/local/bin
appendfilename "appendonly-6666.aof"
ruby redis-trib.rb info 192.168.100.71:6670
./redis-trib.rb add-node 192.168.100.70:6667 192.168.100.70:6666
./redis-trib.rb add-node 192.168.100.70:6668 192.168.100.70:6666
1、将需要新增的节点下aof、rdb、node本地备份文件删除
172.168.63.201:7001> flushdb #清空当前数据库
Node 127.0.0.1:9003 is not empty! Reshard data away and try again.
ruby ./redis-trib.rb del-node 127.0.0.1:6669 44458be24b9b7859a55bc30ad73be536307e5fa1
删除的节点必须是空的,也就是不能缓存任何数据,否则会删除不成功。对于非空节点,在删除之前需要重新分片,将缓存的数据转移到别的节点。
./redis-trib.rb check 127.0.0.1:6666
./redis-trib.rb reshard 127.0.0.1:6667
./redis-trib.rb fix 192.168.100.70:6666