redis主从+哨兵模式
主从配置
master:
bind 0.0.0.0 //监控本地所有网卡IP
protected-mode no
客户端连到服务器查看复制信息:
> info replication
slave1:
bind 0.0.0.0
slaveof master_ip master_port //修改master_ip和port
protected-mode no
客户端连到服务器查看复制信息:
> info replication
slave2:
bind 0.0.0.0
slaveof master_ip master_port
protected-mode no
客户端连到服务器查看复制信息:
> info replication
--------------------
哨兵模式:1主2从做好 最少3台机器
配置哨兵模式:
每台机器上修改redis主配置文件设置:bind 0.0.0.0
每台机器上修改sentinel.conf配置文件:添加如下配置
sentinel monitor mymaster 10.0.0.137 6379 1
sentinel down-after-milliseconds mymaster 3000
sentinel failover-timeout mymaster 10000
protected-mode no
每台机器启动服务:
# ./src/redis-sentinel sentinel.conf
注意:每台机器的防火墙
主从配置
master:
bind 0.0.0.0 //监控本地所有网卡IP
protected-mode no
客户端连到服务器查看复制信息:
> info replication
slave1:
bind 0.0.0.0
slaveof master_ip master_port //修改master_ip和port
protected-mode no
客户端连到服务器查看复制信息:
> info replication
slave2:
bind 0.0.0.0
slaveof master_ip master_port
protected-mode no
客户端连到服务器查看复制信息:
> info replication
--------------------
哨兵模式:1主2从做好 最少3台机器
配置哨兵模式:
每台机器上修改redis主配置文件设置:bind 0.0.0.0
每台机器上修改sentinel.conf配置文件:添加如下配置
sentinel monitor mymaster 10.0.0.137 6379 1
sentinel down-after-milliseconds mymaster 3000
sentinel failover-timeout mymaster 10000
protected-mode no
每台机器启动服务:
# ./src/redis-sentinel sentinel.conf
注意:每台机器的防火墙