标签:var 表示 ISE serve file 启动 tar 复制 添加
环境规划部署ip地址 | 规划节点 |
---|---|
192.168.31.177 | Master redis-sentinel |
192.168.31.178 | Slave1 redis-sentinel |
192.168.31.179 | Slave2 redis-sentinel |
我这里是安装一键部署的
wget -c http://mirrors.linuxeye.com/oneinstack-full.tar.gz
192.168.31.178 配置
bind 127.0.0.1 192.168.31.178 #修改
slaveof 192.168.31.177 6379 #新增
masterauth # #这里填写客户端设置的密码 requirepass 我这里没有设置密码
192.168.31.179 配置
bind 127.0.0.1 192.168.31.179 #修改
slaveof 192.168.31.177 6379 #新增
masterauth #这里填写客户端设置的密码 requirepass 我这里没有设置密码
重启各自的redis-server即可
[root@server1 etc]# cat sentinel.conf
# 端口
port 26379
# 日志文件
logfile "/usr/local/redis/var/sentinel.log"
#放后台启动
daemonize yes
# 哨兵监控主节点的IP和端口 2表示至少一个节点认为主节点down了,才开始选举新节点
sentinel monitor hanye 192.168.31.177 6379 2
# 多少毫秒没有接收到主节点的反馈,认为主节点down
sentinel down-after-milliseconds hanye 15000
#数据存放位置
dir "/usr/local/redis/etc"
protected-mode no
# failover过期时间
sentinel failover-timeout hanye 120000
# 配置哨兵连接主节点的认证密码。(主节点配置的requirepass)
#sentinel auth-pass hanye null
然后把此配置文件复制其他server
[root@server1 etc]# scp /usr/local/redis/etc/sentinel.conf 192.168.31.178:/usr/local/redis/etc/
[root@server1 etc]# scp /usr/local/redis/etc/sentinel.conf 192.168.31.179:/usr/local/redis/etc/
/usr/local/redis/bin/redis-sentinel /usr/local/redis/etc/sentinel.conf
启动完毕 redis-sentine 会在各自的配置文件添加数据
[root@server2 ~]# cat /usr/local/redis/etc/sentinel.conf
# 端口
port 26379
# 日志文件
logfile "/usr/local/redis/var/sentinel.log"
daemonize yes
sentinel myid 0e45194a89320d71313365f6163b691f1c9af021
sentinel deny-scripts-reconfig yes
sentinel monitor hanye 192.168.31.178 6379 2
sentinel down-after-milliseconds hanye 15000
# Generated by CONFIG REWRITE
dir "/usr/local/redis/etc"
protected-mode no
sentinel failover-timeout hanye 120000
sentinel config-epoch hanye 3
sentinel leader-epoch hanye 3
sentinel known-replica hanye 192.168.31.179 6379
sentinel known-replica hanye 192.168.31.177 6379
sentinel known-sentinel hanye 192.168.31.179 26379 1129fde41103b653b80efa8aeab519b36860f5b6
sentinel known-sentinel hanye 192.168.31.177 26379 ee5750ab52459c60b9f9ccb6d11f5ecf219f9ffe
sentinel current-epoch 3
[root@server1 etc]# kilall redis-server
标签:var 表示 ISE serve file 启动 tar 复制 添加
原文地址:https://blog.51cto.com/9025736/2498152