006.MySQL雙主-Master02可用配置
阿新 • • 發佈:2018-11-05
1 [[email protected] ~]# vim /etc/keepalived/keepalived.conf 2 ! Configuration File for keepalived 3 global_defs { 4 notification_email { 5 [email protected] 6 [email protected] 7 [email protected] 8 } 9 notification_email_from [email protected]10 smtp_server 172.24.8.11 11 smtp_connect_timeout 30 12 router_id LVS_DEVEL 13 vrrp_skip_check_adv_addr 14 vrrp_strict 15 vrrp_garp_interval 0 16 vrrp_gna_interval 0 17 } 18 vrrp_instance HA_1 { 19 state BACKUP #在Master01和Master02上均配置為BACKUP 20 interface eth1 21 virtual_router_id 51 22priority 90 23 advert_int 1 24 nopreempt #不搶佔模式,只有優先順序高的機器上設定即可,優先順序低的機器可不設定 25 authentication { 26 auth_type PASS 27 auth_pass 1111 28 } 29 virtual_ipaddress { 30 172.24.8.12 31 } 32 } 33 34 virtual_server 172.24.8.12 3306 { 35 delay_loop 2 36lb_algo wrr 37 lb_kind DR 38 persistence_timeout 60 #會話保持時間 39 protocol TCP 40 real_server 172.24.8.11 3306 { 41 weight 3 42 notify_down /root/shutdown.sh #檢測到服務down後執行的指令碼 43 TCP_CHECK { 44 connect_timeout 10 #連線超時時間 45 nb_get_retry 3 #重連次數 46 delay_before_retry 3 #重連間隔時間 47 connect_port 3306 #健康檢查埠 48 } 49 } 50 }