欧美一级特黄大片做受成人-亚洲成人一区二区电影-激情熟女一区二区三区-日韩专区欧美专区国产专区

keepalived怎么配置redis主從切換-創(chuàng)新互聯(lián)

本篇內(nèi)容介紹了“keepalived怎么配置redis主從切換”的有關(guān)知識(shí),在實(shí)際案例的操作過程中,不少人都會(huì)遇到這樣的困境,接下來就讓小編帶領(lǐng)大家學(xué)習(xí)一下如何處理這些情況吧!希望大家仔細(xì)閱讀,能夠?qū)W有所成!

創(chuàng)新互聯(lián)公司是一家從事企業(yè)網(wǎng)站建設(shè)、成都做網(wǎng)站、網(wǎng)站設(shè)計(jì)、行業(yè)門戶網(wǎng)站建設(shè)、網(wǎng)頁(yè)設(shè)計(jì)制作的專業(yè)網(wǎng)站設(shè)計(jì)公司,擁有經(jīng)驗(yàn)豐富的網(wǎng)站建設(shè)工程師和網(wǎng)頁(yè)設(shè)計(jì)人員,具備各種規(guī)模與類型網(wǎng)站建設(shè)的實(shí)力,在網(wǎng)站建設(shè)領(lǐng)域樹立了自己獨(dú)特的設(shè)計(jì)風(fēng)格。自公司成立以來曾獨(dú)立設(shè)計(jì)制作的站點(diǎn)千余家。

IP規(guī)劃:

主節(jié)點(diǎn):10.0.37.224

備節(jié)點(diǎn):10.0.37.225

VIP:10.0.37.226

一 2個(gè)節(jié)點(diǎn)安裝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

#啟動(dòng)

[root@ray0redis02 ~]# /usr/local/redis/bin/redis-server /usr/local/redis/etc/redis.conf

2 配置備節(jié)點(diǎn)slave信息

[root@ray0redis02 ~]# grep "^slaveof" /usr/local/redis/etc/redis.conf

slaveof 10.0.37.224 6379

#啟動(dòng)

[root@ray0redis02 ~]# /usr/local/redis/bin/redis-server /usr/local/redis/etc/redis.conf

二安裝keepalived

1 兩個(gè)節(jié)點(diǎn)都使用yum安裝keepalived

[root@ray0redis01 ~]# yum -y install keepalived

[root@ray0redis02 ~]# yum -y install keepalived

2 主節(jié)點(diǎn)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   ##需要修改為實(shí)際網(wǎng)卡名稱

    virtual_router_id 60

    priority 100          ##權(quán)重,數(shù)字越大權(quán)重越大,主節(jié)點(diǎn)數(shù)值大于備節(jié)點(diǎn)

    advert_int 1

authentication {   #all node must same

        auth_type PASS

        auth_pass 1111

    }

    virtual_ipaddress {

        10.0.37.226     ##需要修改為實(shí)際分配的虛擬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需要修改為實(shí)際的遠(yuǎn)端主機(jī)IP

    notify_backup "/etc/keepalived/scripts/redis_backup.sh 127.0.0.1 10.0.37.225 6379"     ## 10.0.37.225需要修改為實(shí)際的遠(yuǎn)端主機(jī)IP

    notify_fault /etc/keepalived/scripts/redis_fault.sh

    notify_stop /etc/keepalived/scripts/redis_stop.sh

}


3 備節(jié)點(diǎn)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   ##需要修改為實(shí)際網(wǎng)卡名稱

    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     ##需要修改為實(shí)際分配的虛擬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需要修改為實(shí)際的遠(yuǎn)端主機(jī)IP

    notify_backup "/etc/keepalived/scripts/redis_backup.sh 127.0.0.1 10.0.37.224 6379"     ## 10.0.37.224需要修改為實(shí)際的遠(yuǎn)端主機(jī)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 兩個(gè)節(jié)點(diǎn)所有的腳本

[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

三 啟動(dòng)keepalived,驗(yàn)證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進(jìn)程

[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.

#觀察備節(jié)點(diǎn)狀態(tài),完成切換

[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]: <info>  [1543892079.9698] policy: set-hostname: current hostname was changed outside NetworkManager: 'ray0redis02'

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

#啟動(dòng)主節(jié)點(diǎn),keepalived和redis切換回主節(jié)點(diǎn)

[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]: <info>  [1543892079.9698] policy: set-hostname: current hostname was changed outside NetworkManager: 'ray0redis02'

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]: <info>  [1543892199.0770] policy: set-hostname: current hostname was changed outside NetworkManager: 'ray0redis02'

[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主從切換”的內(nèi)容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業(yè)相關(guān)的知識(shí)可以關(guān)注創(chuàng)新互聯(lián)網(wǎng)站,小編將為大家輸出更多高質(zhì)量的實(shí)用文章!

當(dāng)前名稱:keepalived怎么配置redis主從切換-創(chuàng)新互聯(lián)
標(biāo)題路徑:http://aaarwkj.com/article20/iedco.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供Google、品牌網(wǎng)站制作、網(wǎng)站策劃、微信小程序、企業(yè)網(wǎng)站制作網(wǎng)站建設(shè)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)

網(wǎng)站優(yōu)化排名
亚洲一区二区三区免费在线视频| av午夜精品一区二区| 亚洲国产中文一区二区久久| 日韩毛片中文字幕在线观看| 亚洲综合福利视频网站| 日韩欧美国产亚洲在线| 日韩国产欧美亚洲一区| 漂亮人妻被中出中文字幕| 国产精品成人大片在线播放| 丰满少妇一区二区三区专区| 亚洲激情人妻小说网| 国产亚洲欧美日韩中文字幕 | 亚洲中文字幕高清无二区| 精品日韩欧美精品日韩| 日韩精品一区二区三区欲色av| 日韩精品一区二区在线天天狠天 | 国产三级精品三线在线观看 | 久久精品国产亚洲av高清一区| 91极品气质女神长腿翘臀| 人妻中文字幕在线一二区| 97成人在线视频免费播放| 日韩女优在线播放一区二区| 午夜一区二区三区精品| 中文字幕日韩不卡顿一区二区| 毛片一区二区三区免费看| 亚洲精品入口一区二区| 又爽又色的日本网站| 国产伦一区二区三区三州| 国产精品无卡无在线播放| 青青草原综合视频在线| 成人爱爱视频在线免费观看| 国产真人作爱视频免费| 精品国产不卡在线观看| 国产丝袜美女一区二区| 亚洲成av人亚洲av| 日韩人妻熟妇中文字幕| 日韩av高清在线播放| 亚洲老司机深夜福利| 美女露脸口爆吞精视频| 日韩毛片中文字幕在线观看| 乱码人妻精品一区二区三区|