虚IP是192.168.21.36,两个机器的配置中,都要配置为MASTER,否则自动切换不成功!
主机keepalived.conf
- global_defs {
- router_id MYSQL_NODE_1
- }
- vrrp_script chk_mysql_port {
- script "
- interval 3
- weight -2
- fail 1
- rise 1
- }
- vrrp_instance V_MYSQLSERVER {
- state MASTER
- interface eth2
- lvs_sync_daemon_inteface eth2
- virtual_router_id 152
- priority 100
- advert_int 2
- authentication {
- auth_type PASS
- auth_pass 4321
- }
- track_script {
- chk_mysql_port
- }
- virtual_ipaddress {
- 192.168.21.36
- }
- }
从机keepalived.conf
- global_defs {
- router_id MYSQL_NODE_1
- }
- vrrp_script chk_mysql_port {
- script "
- interval 3
- weight -2
- fail 1
- rise 1
- }
- vrrp_instance V_MYSQLSERVER {
- state MASTER
- interface eth2
- lvs_sync_daemon_inteface eth2
- virtual_router_id 152
- priority 99
- advert_int 2
- authentication {
- auth_type PASS
- auth_pass 4321
- }
- track_script {
- chk_mysql_port
- }
- virtual_ipaddress {
- 192.168.21.36
- }
- }
阅读(12550) | 评论(0) | 转发(2) |