34 lines
		
	
	
		
			711 B
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			34 lines
		
	
	
		
			711 B
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
global_defs {
 | 
						||
    router_id mysql1 # 在另一台服务器中,这里配置 mysql2
 | 
						||
    script_user root
 | 
						||
    enable_script_security
 | 
						||
}
 | 
						||
 | 
						||
vrrp_script chk_mysql {
 | 
						||
    script "/sbin/ss -lnt | grep -q ':3306\>'"
 | 
						||
    interval 10
 | 
						||
    weight 0
 | 
						||
    fall 2
 | 
						||
    rise 2
 | 
						||
}
 | 
						||
 | 
						||
vrrp_instance VI_1 {
 | 
						||
    state BACKUP
 | 
						||
    virtual_router_id 13
 | 
						||
    priority 150 # 在另一台服务器中,这里配置100
 | 
						||
    advert_int 2
 | 
						||
    nopreempt
 | 
						||
    interface eth0 # 这里的 eth0 是服务器的网卡名
 | 
						||
    track_script {
 | 
						||
        chk_mysql
 | 
						||
    }
 | 
						||
    authentication {
 | 
						||
        auth_type PASS
 | 
						||
        auth_pass El_en_mysql_1234
 | 
						||
    }
 | 
						||
    virtual_ipaddress {
 | 
						||
        虚拟IP/掩码 dev eth0 # 这里的eth0是服务器的网卡名
 | 
						||
    }
 | 
						||
}
 | 
						||
 |