005.MySQL双主-Master01可用配置

  1 [root@Master01 ~]# 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.10
 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
 22     priority 100
 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
 36      lb_algo wrr
 37      lb_kind DR
 38      persistence_timeout 60	#会话保持时间
 39      protocol TCP
 40      real_server 172.24.8.10 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 }

你可能感兴趣的:(005.MySQL双主-Master01可用配置)