keepalived怎么配置redis主从切换
本篇内容介绍了“keepalived怎么配置redis主从切换”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!
成都创新互联公司长期为近1000家客户提供的网站建设服务,团队从业经验10年,关注不同地域、不同群体,并针对不同对象提供差异化的产品和服务;打造开放共赢平台,与合作伙伴共同营造健康的互联网生态环境。为夹江企业提供专业的做网站、网站制作,夹江网站改版等技术服务。拥有十余年丰富建站经验和众多成功案例,为您定制开发。
IP规划:
主节点:10.0.37.224
备节点:10.0.37.225
VIP:10.0.37.226
一 2个节点安装redis
1 安装
[root@ray0redis02 ~]# wget http://download.redis.io/releases/redis-4.0.9.tar.gz [root@ray0redis02 ~]# tar xzf redis-4.0.9.tar.gz [root@ray0redis02 ~]# cd redis-4.0.9 [root@ray0redis02 ~]# make [root@ray0redis02 ~]# make install [root@ray0redis02 ~]# mkdir -p /usr/local/redis/bin [root@ray0redis02 ~]# mkdir -p /usr/local/redis/etc [root@ray0redis02 ~]# cp redis.conf /usr/local/redis/etc [root@ray0redis02 ~]# cd src/ [root@ray0redis02 ~]# cp mkreleasehdr.sh redis-benchmark redis-check-aof redis-cli redis-server /usr/local/redis/bin #[root@ray0redis02 ~]$ vi /usr/local/redis/etc/redis.conf #将daemonize的值改为yes [root@ray0redis02 ~]# sed -i 's/daemonize no/daemonize yes/g' /usr/local/redis/etc/redis.conf #启动 [root@ray0redis02 ~]# /usr/local/redis/bin/redis-server /usr/local/redis/etc/redis.conf |
2 配置备节点slave信息
[root@ray0redis02 ~]# grep "^slaveof" /usr/local/redis/etc/redis.conf slaveof 10.0.37.224 6379 #启动 [root@ray0redis02 ~]# /usr/local/redis/bin/redis-server /usr/local/redis/etc/redis.conf |
二安装keepalived
1 两个节点都使用yum安装keepalived
[root@ray0redis01 ~]# yum -y install keepalived |
[root@ray0redis02 ~]# yum -y install keepalived |
2 主节点keepalived配置文件
[root@ray0redis01 ~]# cat /etc/keepalived/keepalived.conf ! Configuration File for keepalived global_defs { router_id redis01 } vrrp_script chk_redis { script "/etc/keepalived/scripts/redis_check.sh" interval 2 timeout 2 fall 3 } vrrp_instance redis { state MASTER interface ens192 ##需要修改为实际网卡名称 virtual_router_id 60 priority 100 ##权重,数字越大权重越大,主节点数值大于备节点 advert_int 1 authentication { #all node must same auth_type PASS auth_pass 1111 } virtual_ipaddress { 10.0.37.226 ##需要修改为实际分配的虚拟IP } track_script { chk_redis } notify_master "/etc/keepalived/scripts/redis_master.sh 127.0.0.1 10.0.37.225 6379" ## 10.0.37.225需要修改为实际的远端主机IP notify_backup "/etc/keepalived/scripts/redis_backup.sh 127.0.0.1 10.0.37.225 6379" ## 10.0.37.225需要修改为实际的远端主机IP notify_fault /etc/keepalived/scripts/redis_fault.sh notify_stop /etc/keepalived/scripts/redis_stop.sh } |
3 备节点keepalived配置文件
[root@ray0redis02 ~]# cat /etc/keepalived/keepalived.conf ! Configuration File for keepalived global_defs { router_id redis02 } vrrp_script chk_redis { script "/etc/keepalived/scripts/redis_check.sh" interval 2 timeout 2 fall 3 } vrrp_instance redis { state BACKUP interface ens192 ##需要修改为实际网卡名称 virtual_router_id 60 priority 90 advert_int 1 authentication { #all node must same auth_type PASS auth_pass 1111 } virtual_ipaddress { 10.0.37.226 ##需要修改为实际分配的虚拟IP } track_script { chk_redis } notify_master "/etc/keepalived/scripts/redis_master.sh 127.0.0.1 10.0.37.224 6379" ## 10.0.37.224需要修改为实际的远端主机IP notify_backup "/etc/keepalived/scripts/redis_backup.sh 127.0.0.1 10.0.37.224 6379" ## 10.0.37.224需要修改为实际的远端主机IP notify_fault /etc/keepalived/scripts/redis_fault.sh notify_stop /etc/keepalived/scripts/redis_stop.sh } virtual_server 10.0.37.226 6379 { delay_loop 6 lb_algo rr lb_kind NAT nat_mask 255.255.255.0 persistence_timeout 50 protocol TCP sorry_server 127.0.0.1 80 real_server 10.0.37.224 6379 { weight 1 TCP_CHECK { connect_timeout 3 nb_get_retry 3 delay_before_retry 3 connect_port 6379 } } real_server 10.0.37.225 6379 { weight 1 TCP_CHECK { connect_timeout 3 nb_get_retry 3 delay_before_retry 3 connect_port 6379 } } } |
4 两个节点所有的脚本
[root@ray0redis01 ~]# cat /etc/keepalived/scripts/redis_check.sh #!/bin/bash ALIVE=`/usr/local/redis/bin/redis-cli -a 123456 PING` [ "$ALIVE" == "PONG" ] && { echo $ALIVE && exit 0; } || { echo $ALIVE && exit 1; } |
[root@ray0redis01 ~]# cat /etc/keepalived/scripts/redis_master.sh #!/bin/bash REDISCLI="/usr/local/redis/bin/redis-cli -h $1 -p $3" LOGFILE="/var/log/keepalived-redis-state.log" echo "[master]" >> $LOGFILE date >> $LOGFILE echo "Being master...." >> $LOGFILE echo "Run MASTER cmd ..." >> $LOGFILE $REDISCLI SLAVEOF $2 $3 >> $LOGFILE sleep 10 #delay 10 s wait data async cancel sync echo "Run SLAVEOF NO ONE cmd ..." >> $LOGFILE ${REDISCLI} SLAVEOF NO ONE >> $LOGFILE |
[root@ray0redis01 ~]# cat /etc/keepalived/scripts/redis_backup.sh #!/bin/bash REDISCLI="/usr/local/redis/bin/redis-cli -h $1 -p $3" LOGFILE="/var/log/keepalived-redis-state.log" echo "[backup]" >> $LOGFILE date >> $LOGFILE echo "Run SLAVEOF cmd ..." >> $LOGFILE $REDISCLI SLAVEOF $2 $3 >> $LOGFILE 2>&1 sleep 15 #delay 15 s wait data sync exchange role |
[root@ray0redis01 ~]# cat /etc/keepalived/scripts/redis_fault.sh #!/bin/bash LOGFILE=/var/log/keepalived-redis-state.log echo -e "[fault]\t$(date '+%F %T')" >> $LOGFILE |
[root@ray0redis01 ~]# cat /etc/keepalived/scripts/redis_stop.sh #!/bin/bash LOGFILE=/var/log/keepalived-redis-state.log |
三 启动keepalived,验证HA的情况和切换
[root@ray0redis01 ~]# systemctl status keepalived ● keepalived.service - LVS and VRRP High Availability Monitor Loaded: loaded (/usr/lib/systemd/system/keepalived.service; disabled; vendor preset: disabled) Active: active (running) since Mon 2018-12-03 20:41:42 EST; 1h 10min ago Process: 5122 ExecStart=/usr/sbin/keepalived $KEEPALIVED_OPTIONS (code=exited, status=0/SUCCESS) Main PID: 5124 (keepalived) CGroup: /system.slice/keepalived.service ├─5124 /usr/sbin/keepalived -D ├─5125 /usr/sbin/keepalived -D └─5126 /usr/sbin/keepalived -D Dec 03 20:57:08 ray0redis01 Keepalived_vrrp[5126]: Sending gratuitous ARP on ens192 for 10.0.37.226 Dec 03 20:57:08 ray0redis01 Keepalived_vrrp[5126]: Sending gratuitous ARP on ens192 for 10.0.37.226 Dec 03 20:57:08 ray0redis01 Keepalived_vrrp[5126]: Sending gratuitous ARP on ens192 for 10.0.37.226 Dec 03 20:57:08 ray0redis01 Keepalived_vrrp[5126]: Opening script file /etc/keepalived/scripts/redis_master.sh Dec 03 20:57:13 ray0redis01 Keepalived_vrrp[5126]: Sending gratuitous ARP on ens192 for 10.0.37.226 Dec 03 20:57:13 ray0redis01 Keepalived_vrrp[5126]: VRRP_Instance(redis) Sending/queueing gratuitous ARPs on ens192 for 10.0.37.226 Dec 03 20:57:13 ray0redis01 Keepalived_vrrp[5126]: Sending gratuitous ARP on ens192 for 10.0.37.226 Dec 03 20:57:13 ray0redis01 Keepalived_vrrp[5126]: Sending gratuitous ARP on ens192 for 10.0.37.226 Dec 03 20:57:13 ray0redis01 Keepalived_vrrp[5126]: Sending gratuitous ARP on ens192 for 10.0.37.226 Dec 03 20:57:13 ray0redis01 Keepalived_vrrp[5126]: Sending gratuitous ARP on ens192 for 10.0.37.226 [root@ray0redis01 ~]# /usr/local/redis/bin/redis-cli info | egrep -A11 Replication # Replication role:master connected_slaves:1 slave0:ip=10.0.37.225,port=6379,state=online,offset=4928,lag=1 master_replid:ac8db2b7075f51c318b978be0a350b7fd987ddbb master_replid2:3e93b153857adbdfa981a3f66fd18244b9bfae5c master_repl_offset:4928 second_repl_offset:183 repl_backlog_active:1 repl_backlog_size:1048576 repl_backlog_first_byte_offset:183 repl_backlog_histlen:4746 #杀掉redis进程 [root@ray0redis01 ~]# kill -9 6605 [root@ray0redis01 ~]# systemctl status keepalived ● keepalived.service - LVS and VRRP High Availability Monitor Loaded: loaded (/usr/lib/systemd/system/keepalived.service; disabled; vendor preset: disabled) Active: active (running) since Mon 2018-12-03 20:41:42 EST; 1h 12min ago Process: 5122 ExecStart=/usr/sbin/keepalived $KEEPALIVED_OPTIONS (code=exited, status=0/SUCCESS) Main PID: 5124 (keepalived) CGroup: /system.slice/keepalived.service ├─5124 /usr/sbin/keepalived -D ├─5125 /usr/sbin/keepalived -D └─5126 /usr/sbin/keepalived -D Dec 03 20:57:08 ray0redis01 Keepalived_vrrp[5126]: Sending gratuitous ARP on ens192 for 10.0.37.226 Dec 03 20:57:08 ray0redis01 Keepalived_vrrp[5126]: Opening script file /etc/keepalived/scripts/redis_master.sh Dec 03 20:57:13 ray0redis01 Keepalived_vrrp[5126]: Sending gratuitous ARP on ens192 for 10.0.37.226 Dec 03 20:57:13 ray0redis01 Keepalived_vrrp[5126]: VRRP_Instance(redis) Sending/queueing gratuitous ARPs on ens192 for 10.0.37.226 Dec 03 20:57:13 ray0redis01 Keepalived_vrrp[5126]: Sending gratuitous ARP on ens192 for 10.0.37.226 Dec 03 20:57:13 ray0redis01 Keepalived_vrrp[5126]: Sending gratuitous ARP on ens192 for 10.0.37.226 Dec 03 20:57:13 ray0redis01 Keepalived_vrrp[5126]: Sending gratuitous ARP on ens192 for 10.0.37.226 Dec 03 20:57:13 ray0redis01 Keepalived_vrrp[5126]: Sending gratuitous ARP on ens192 for 10.0.37.226 Dec 03 21:54:33 ray0redis01 Keepalived_vrrp[5126]: /etc/keepalived/scripts/redis_check.sh exited with status 1 Dec 03 21:54:34 ray0redis01 Keepalived_healthcheckers[5125]: TCP connection to [10.0.37.224]:6379 failed. #观察备节点状态,完成切换 [root@ray0redis02 ~]# systemctl status keepalived ● keepalived.service - LVS and VRRP High Availability Monitor Loaded: loaded (/usr/lib/systemd/system/keepalived.service; disabled; vendor preset: disabled) Active: active (running) since Mon 2018-12-03 20:54:37 EST; 1h 0min ago Process: 6112 ExecStart=/usr/sbin/keepalived $KEEPALIVED_OPTIONS (code=exited, status=0/SUCCESS) Main PID: 6114 (keepalived) CGroup: /system.slice/keepalived.service ├─6114 /usr/sbin/keepalived -D ├─6115 /usr/sbin/keepalived -D └─6116 /usr/sbin/keepalived -D Dec 03 21:54:39 ray0redis02 Keepalived_vrrp[6116]: Opening script file /etc/keepalived/scripts/redis_master.sh Dec 03 21:54:41 ray0redis02 Keepalived_healthcheckers[6115]: TCP connection to [10.0.37.224]:6379 failed. Dec 03 21:54:41 ray0redis02 Keepalived_healthcheckers[6115]: Check on service [10.0.37.224]:6379 failed after 1 retry. Dec 03 21:54:41 ray0redis02 Keepalived_healthcheckers[6115]: Removing service [10.0.37.224]:6379 from VS [10.0.37.226]:6379 Dec 03 21:54:44 ray0redis02 Keepalived_vrrp[6116]: Sending gratuitous ARP on ens192 for 10.0.37.226 Dec 03 21:54:44 ray0redis02 Keepalived_vrrp[6116]: VRRP_Instance(redis) Sending/queueing gratuitous ARPs on ens192 for 10.0.37.226 Dec 03 21:54:44 ray0redis02 Keepalived_vrrp[6116]: Sending gratuitous ARP on ens192 for 10.0.37.226 Dec 03 21:54:44 ray0redis02 Keepalived_vrrp[6116]: Sending gratuitous ARP on ens192 for 10.0.37.226 Dec 03 21:54:44 ray0redis02 Keepalived_vrrp[6116]: Sending gratuitous ARP on ens192 for 10.0.37.226 Dec 03 21:54:44 ray0redis02 Keepalived_vrrp[6116]: Sending gratuitous ARP on ens192 for 10.0.37.226 [root@ray0redis02 ~]# tail -20f /var/log/messages Dec 3 21:54:38 localhost Keepalived_healthcheckers[6115]: TCP connection to [10.0.37.224]:6379 failed. Dec 3 21:54:38 localhost Keepalived_vrrp[6116]: VRRP_Instance(redis) Transition to MASTER STATE Dec 3 21:54:39 localhost Keepalived_vrrp[6116]: VRRP_Instance(redis) Entering MASTER STATE Dec 3 21:54:39 localhost Keepalived_vrrp[6116]: VRRP_Instance(redis) setting protocol VIPs. Dec 3 21:54:39 localhost Keepalived_vrrp[6116]: Sending gratuitous ARP on ens192 for 10.0.37.226 Dec 3 21:54:39 localhost Keepalived_vrrp[6116]: VRRP_Instance(redis) Sending/queueing gratuitous ARPs on ens192 for 10.0.37.226 Dec 3 21:54:39 localhost Keepalived_vrrp[6116]: Sending gratuitous ARP on ens192 for 10.0.37.226 Dec 3 21:54:39 localhost Keepalived_vrrp[6116]: Sending gratuitous ARP on ens192 for 10.0.37.226 Dec 3 21:54:39 localhost Keepalived_vrrp[6116]: Sending gratuitous ARP on ens192 for 10.0.37.226 Dec 3 21:54:39 localhost Keepalived_vrrp[6116]: Sending gratuitous ARP on ens192 for 10.0.37.226 Dec 3 21:54:39 localhost NetworkManager[758]: Dec 3 21:54:41 localhost Keepalived_healthcheckers[6115]: TCP connection to [10.0.37.224]:6379 failed. Dec 3 21:54:41 localhost Keepalived_healthcheckers[6115]: Check on service [10.0.37.224]:6379 failed after 1 retry. Dec 3 21:54:41 localhost Keepalived_healthcheckers[6115]: Removing service [10.0.37.224]:6379 from VS [10.0.37.226]:6379 Dec 3 21:54:44 localhost Keepalived_vrrp[6116]: Sending gratuitous ARP on ens192 for 10.0.37.226 Dec 3 21:54:44 localhost Keepalived_vrrp[6116]: VRRP_Instance(redis) Sending/queueing gratuitous ARPs on ens192 for 10.0.37.226 Dec 3 21:54:44 localhost Keepalived_vrrp[6116]: Sending gratuitous ARP on ens192 for 10.0.37.226 Dec 3 21:54:44 localhost Keepalived_vrrp[6116]: Sending gratuitous ARP on ens192 for 10.0.37.226 Dec 3 21:54:44 localhost Keepalived_vrrp[6116]: Sending gratuitous ARP on ens192 for 10.0.37.226 Dec 3 21:54:44 localhost Keepalived_vrrp[6116]: Sending gratuitous ARP on ens192 for 10.0.37.226 |
#启动主节点,keepalived和redis切换回主节点 [root@ray0redis01 ~]# /usr/local/redis/bin/redis-server /usr/local/redis/etc/redis.conf 12049:C 03 Dec 21:56:37.698 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo 12049:C 03 Dec 21:56:37.698 # Redis version=4.0.9, bits=64, commit=00000000, modified=0, pid=12049, just started 12049:C 03 Dec 21:56:37.698 # Configuration loaded [root@ray0redis01 ~]# systemctl status keepalived ● keepalived.service - LVS and VRRP High Availability Monitor Loaded: loaded (/usr/lib/systemd/system/keepalived.service; disabled; vendor preset: disabled) Active: active (running) since Mon 2018-12-03 20:41:42 EST; 1h 14min ago Process: 5122 ExecStart=/usr/sbin/keepalived $KEEPALIVED_OPTIONS (code=exited, status=0/SUCCESS) Main PID: 5124 (keepalived) CGroup: /system.slice/keepalived.service ├─ 5124 /usr/sbin/keepalived -D ├─ 5125 /usr/sbin/keepalived -D ├─ 5126 /usr/sbin/keepalived -D ├─12057 /usr/sbin/keepalived -D ├─12058 /bin/bash /etc/keepalived/scripts/redis_backup.sh 127.0.0.1 10.0.37.225 6379 └─12061 sleep 15 Dec 03 21:56:26 ray0redis01 Keepalived_vrrp[5126]: /etc/keepalived/scripts/redis_check.sh exited with status 1 Dec 03 21:56:28 ray0redis01 Keepalived_vrrp[5126]: /etc/keepalived/scripts/redis_check.sh exited with status 1 Dec 03 21:56:30 ray0redis01 Keepalived_vrrp[5126]: /etc/keepalived/scripts/redis_check.sh exited with status 1 Dec 03 21:56:32 ray0redis01 Keepalived_vrrp[5126]: /etc/keepalived/scripts/redis_check.sh exited with status 1 Dec 03 21:56:34 ray0redis01 Keepalived_vrrp[5126]: /etc/keepalived/scripts/redis_check.sh exited with status 1 Dec 03 21:56:36 ray0redis01 Keepalived_vrrp[5126]: /etc/keepalived/scripts/redis_check.sh exited with status 1 Dec 03 21:56:38 ray0redis01 Keepalived_vrrp[5126]: VRRP_Script(chk_redis) succeeded Dec 03 21:56:38 ray0redis01 Keepalived_vrrp[5126]: VRRP_Instance(redis) Entering BACKUP STATE Dec 03 21:56:38 ray0redis01 Keepalived_vrrp[5126]: Opening script file /etc/keepalived/scripts/redis_backup.sh Dec 03 21:56:39 ray0redis01 Keepalived_vrrp[5126]: VRRP_Instance(redis) forcing a new MASTER election [root@ray0redis01 ~]# [root@ray0redis01 ~]# systemctl status keepalived ● keepalived.service - LVS and VRRP High Availability Monitor Loaded: loaded (/usr/lib/systemd/system/keepalived.service; disabled; vendor preset: disabled) Active: active (running) since Mon 2018-12-03 20:41:42 EST; 1h 15min ago Process: 5122 ExecStart=/usr/sbin/keepalived $KEEPALIVED_OPTIONS (code=exited, status=0/SUCCESS) Main PID: 5124 (keepalived) CGroup: /system.slice/keepalived.service ├─5124 /usr/sbin/keepalived -D ├─5125 /usr/sbin/keepalived -D └─5126 /usr/sbin/keepalived -D Dec 03 21:56:41 ray0redis01 Keepalived_vrrp[5126]: Sending gratuitous ARP on ens192 for 10.0.37.226 Dec 03 21:56:41 ray0redis01 Keepalived_vrrp[5126]: Sending gratuitous ARP on ens192 for 10.0.37.226 Dec 03 21:56:41 ray0redis01 Keepalived_vrrp[5126]: Sending gratuitous ARP on ens192 for 10.0.37.226 Dec 03 21:56:41 ray0redis01 Keepalived_vrrp[5126]: Opening script file /etc/keepalived/scripts/redis_master.sh Dec 03 21:56:46 ray0redis01 Keepalived_vrrp[5126]: Sending gratuitous ARP on ens192 for 10.0.37.226 Dec 03 21:56:46 ray0redis01 Keepalived_vrrp[5126]: VRRP_Instance(redis) Sending/queueing gratuitous ARPs on ens192 for 10.0.37.226 Dec 03 21:56:46 ray0redis01 Keepalived_vrrp[5126]: Sending gratuitous ARP on ens192 for 10.0.37.226 Dec 03 21:56:46 ray0redis01 Keepalived_vrrp[5126]: Sending gratuitous ARP on ens192 for 10.0.37.226 Dec 03 21:56:46 ray0redis01 Keepalived_vrrp[5126]: Sending gratuitous ARP on ens192 for 10.0.37.226 Dec 03 21:56:46 ray0redis01 Keepalived_vrrp[5126]: Sending gratuitous ARP on ens192 for 10.0.37.226 [root@ray0redis01 ~]# tail -f /var/log/keepalived-redis-state.log Mon Dec 3 21:56:38 EST 2018 Run SLAVEOF cmd ... OK [master] Mon Dec 3 21:56:41 EST 2018 Being master.... Run MASTER cmd ... OK Already connected to specified master Run SLAVEOF NO ONE cmd ... OK [root@ray0redis02 ~]# systemctl status keepalived ● keepalived.service - LVS and VRRP High Availability Monitor Loaded: loaded (/usr/lib/systemd/system/keepalived.service; disabled; vendor preset: disabled) Active: active (running) since Mon 2018-12-03 20:54:37 EST; 1h 2min ago Process: 6112 ExecStart=/usr/sbin/keepalived $KEEPALIVED_OPTIONS (code=exited, status=0/SUCCESS) Main PID: 6114 (keepalived) CGroup: /system.slice/keepalived.service ├─6114 /usr/sbin/keepalived -D ├─6115 /usr/sbin/keepalived -D └─6116 /usr/sbin/keepalived -D Dec 03 21:54:44 ray0redis02 Keepalived_vrrp[6116]: Sending gratuitous ARP on ens192 for 10.0.37.226 Dec 03 21:54:44 ray0redis02 Keepalived_vrrp[6116]: Sending gratuitous ARP on ens192 for 10.0.37.226 Dec 03 21:54:44 ray0redis02 Keepalived_vrrp[6116]: Sending gratuitous ARP on ens192 for 10.0.37.226 Dec 03 21:54:44 ray0redis02 Keepalived_vrrp[6116]: Sending gratuitous ARP on ens192 for 10.0.37.226 Dec 03 21:56:38 ray0redis02 Keepalived_healthcheckers[6115]: TCP connection to [10.0.37.224]:6379 success. Dec 03 21:56:38 ray0redis02 Keepalived_healthcheckers[6115]: Adding service [10.0.37.224]:6379 to VS [10.0.37.226]:6379 Dec 03 21:56:39 ray0redis02 Keepalived_vrrp[6116]: VRRP_Instance(redis) Received advert with higher priority 100, ours 90 Dec 03 21:56:39 ray0redis02 Keepalived_vrrp[6116]: VRRP_Instance(redis) Entering BACKUP STATE Dec 03 21:56:39 ray0redis02 Keepalived_vrrp[6116]: VRRP_Instance(redis) removing protocol VIPs. Dec 03 21:56:39 ray0redis02 Keepalived_vrrp[6116]: Opening script file /etc/keepalived/scripts/redis_backup.sh [root@ray0redis02 ~]# tail -20f /var/log/messages Dec 3 21:54:39 localhost Keepalived_vrrp[6116]: Sending gratuitous ARP on ens192 for 10.0.37.226 Dec 3 21:54:39 localhost Keepalived_vrrp[6116]: Sending gratuitous ARP on ens192 for 10.0.37.226 Dec 3 21:54:39 localhost Keepalived_vrrp[6116]: Sending gratuitous ARP on ens192 for 10.0.37.226 Dec 3 21:54:39 localhost Keepalived_vrrp[6116]: Sending gratuitous ARP on ens192 for 10.0.37.226 Dec 3 21:54:39 localhost NetworkManager[758]: Dec 3 21:54:41 localhost Keepalived_healthcheckers[6115]: TCP connection to [10.0.37.224]:6379 failed. Dec 3 21:54:41 localhost Keepalived_healthcheckers[6115]: Check on service [10.0.37.224]:6379 failed after 1 retry. Dec 3 21:54:41 localhost Keepalived_healthcheckers[6115]: Removing service [10.0.37.224]:6379 from VS [10.0.37.226]:6379 Dec 3 21:54:44 localhost Keepalived_vrrp[6116]: Sending gratuitous ARP on ens192 for 10.0.37.226 Dec 3 21:54:44 localhost Keepalived_vrrp[6116]: VRRP_Instance(redis) Sending/queueing gratuitous ARPs on ens192 for 10.0.37.226 Dec 3 21:54:44 localhost Keepalived_vrrp[6116]: Sending gratuitous ARP on ens192 for 10.0.37.226 Dec 3 21:54:44 localhost Keepalived_vrrp[6116]: Sending gratuitous ARP on ens192 for 10.0.37.226 Dec 3 21:54:44 localhost Keepalived_vrrp[6116]: Sending gratuitous ARP on ens192 for 10.0.37.226 Dec 3 21:54:44 localhost Keepalived_vrrp[6116]: Sending gratuitous ARP on ens192 for 10.0.37.226 Dec 3 21:56:38 localhost Keepalived_healthcheckers[6115]: TCP connection to [10.0.37.224]:6379 success. Dec 3 21:56:38 localhost Keepalived_healthcheckers[6115]: Adding service [10.0.37.224]:6379 to VS [10.0.37.226]:6379 Dec 3 21:56:39 localhost Keepalived_vrrp[6116]: VRRP_Instance(redis) Received advert with higher priority 100, ours 90 Dec 3 21:56:39 localhost Keepalived_vrrp[6116]: VRRP_Instance(redis) Entering BACKUP STATE Dec 3 21:56:39 localhost Keepalived_vrrp[6116]: VRRP_Instance(redis) removing protocol VIPs. Dec 3 21:56:39 localhost NetworkManager[758]: [root@ray0redis02 ~]# tail -30 /var/log/keepalived-redis-state.log Mon Dec 3 20:53:22 EST 2018 Run SLAVEOF cmd ... OK [stop] 2018-12-03 20:54:37 [backup] Mon Dec 3 20:54:37 EST 2018 Run SLAVEOF cmd ... OK [master] Mon Dec 3 20:55:59 EST 2018 Being master.... Run MASTER cmd ... OK Already connected to specified master Run SLAVEOF NO ONE cmd ... OK [backup] Mon Dec 3 20:57:06 EST 2018 Run SLAVEOF cmd ... OK [master] Mon Dec 3 21:54:39 EST 2018 Being master.... Run MASTER cmd ... OK Already connected to specified master Run SLAVEOF NO ONE cmd ... OK [backup] Mon Dec 3 21:56:39 EST 2018 Run SLAVEOF cmd ... OK |
“keepalived怎么配置redis主从切换”的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识可以关注创新互联网站,小编将为大家输出更多高质量的实用文章!
新闻名称:keepalived怎么配置redis主从切换
URL链接:http://pwwzsj.com/article/jjcohs.html