Redit集群搭建-Sentinel模式搭建
Redit集群搭建
学习了:
Windows:http://blog.csdn.net/mrxiagc/article/details/52799081
Linux:https://www.cnblogs.com/yuanermen/p/5717885.html
Redis集群采用哈希槽(hash slot)进行数据的分配,Redis Cluster默认分配了16384个hash slot,
当我们set一个key时,会使用CRC16算法来取模得到所属的slot,然后将这个key分配到对应的
哈希槽对应的节点上,具体算法就是CRC16(key)%16384。
============================
https://www.jianshu.com/p/42ee966f96e5
运行之后,配置的参数会被redis修改
哨兵模式配置
# master port 6379 bind 0.0.0.0 masterauth 123456 requirepass 123456 slave-read-only yes # slave1 port 6380 bind 0.0.0.0 masterauth 123456 requirepass 123456 slave-read-only yes # slave2 port 6381 bind 0.0.0.0 masterauth 123456 requirepass 123456 slave-read-only yes # sentinel1 port 26379 sentinel monitor redis-master 192.168.1.51 7000 2 sentinel down-after-milliseconds redis-master 5000 sentinel failover-timeout redis-master 900000 sentinel parallel-syncs redis-master 2 sentinel auth-pass redis-master 123456 # sentinel2 port 26380 sentinel monitor redis-master 192.168.1.51 7000 2 sentinel down-after-milliseconds redis-master 5000 sentinel failover-timeout redis-master 900000 sentinel parallel-syncs redis-master 2 sentinel auth-pass redis-master 123456 # sentinel3 port 26381 sentinel monitor redis-master 192.168.1.51 7000 2 sentinel down-after-milliseconds redis-master 5000 sentinel failover-timeout redis-master 900000 sentinel parallel-syncs redis-master 2 sentinel auth-pass redis-master 123456