标签:style color io os ar for strong 文件 数据
tar -zxvf keepalived-1.2.13.tar.gz cd keepalived-1.2.13 ./configure -prefix=/usr/local/keepalived make make install [root@likun keepalived-1.2.13]# cat /opt/mysql/mysql.sh #!/bin/sh pkill keepalived [root@likun keepalived-1.2.13]# chmod +x /opt/mysql/mysql.sh[root@likun keepalived-1.2.13]# cat /usr/local/keepalived/etc/keepalived.conf!ConfigurationFilefor keepalived global_defs { notification_email { likun@163.com } router_id mysql-ha } vrrp_instance VI_20 { state BACKUP interface eth0 virtual_router_id 20 priority 90 advert_int 1 nopreempt authentication { auth_type PASS auth_pass 1111 } virtual_ipaddress { 192.168.1.76 } } virtual_server 192.168.1.763306{ delay_loop 2 lb_algo wrr lb_kind DR persistence_timeout 60 protocol TCP real_server 192.168.1.203306{ weight 3 notify_down /opt/mysql/mysql.sh TCP_CHECK { connect_timeout 10 nb_get_retry 3 delay_before_retry 3 connect_port 3306 } } } !ConfigurationFilefor keepalived global_defs { notification_email { likun@163.com } router_id mysql-ha } vrrp_instance VI_21 { state BACKUP interface eth0 virtual_router_id 20 --注意2边要一致 priority 100 advert_int 1 nopreempt authentication { auth_type PASS auth_pass 1111 } virtual_ipaddress { 192.168.1.76 } } virtual_server 192.168.1.763306{ delay_loop 2 lb_algo wrr lb_kind DR persistence_timeout 60 protocol TCP real_server 192.168.1.213306{ weight 3 notify_down /opt/mysql/mysql.sh TCP_CHECK { connect_timeout 10 nb_get_retry 3 delay_before_retry 3 connect_port 3306 } } } [root@likun1 keepalived-1.2.13]# mysql -h192.168.1.76-P3306 -uroot -prootWelcome to the MySQL monitor. Commands end with ; or \g.YourMySQL connection id is 682Server version:5.5.30-log Source distributionCopyright(c)2000,2013,Oracle and/or its affiliates.All rights reserved.Oracle is a registered trademark of OracleCorporation and/or itsaffiliates.Other names may be trademarks of their respectiveowners.Type‘help;‘ or ‘\h‘for help.Type‘\c‘ to clear the current input statement.mysql> [root@likun1 keepalived-1.2.13]# ip addr show1: lo:<LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo inet6 ::1/128 scope host valid_lft forever preferred_lft forever2: eth0:<BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000 link/ether 08:00:27:5d:ef:c3 brd ff:ff:ff:ff:ff:ff inet 192.168.1.21/24 brd 192.168.1.255 scope global eth0 inet 192.168.1.76/32 scope global eth0 inet6 fe80::a00:27ff:fe5d:efc3/64 scope link valid_lft forever preferred_lft forever[root@likun keepalived-1.2.13]# ip addr show1: lo:<LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo inet6 ::1/128 scope host valid_lft forever preferred_lft forever2: eth0:<BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000 link/ether 08:00:27:00:58:57 brd ff:ff:ff:ff:ff:ff inet 192.168.1.20/24 brd 192.168.1.255 scope global eth0 inet6 fe80::a00:27ff:fe00:5857/64 scope link valid_lft forever preferred_lft foreverJul2020:03:31 likun Keepalived_vrrp[8547]: VRRP_Instance(VI_20)Transition to MASTER STATEJul2020:03:32 likun Keepalived_vrrp[8547]: VRRP_Instance(VI_20)Entering MASTER STATEJul2020:03:32 likun Keepalived_vrrp[8547]: VRRP_Instance(VI_20) setting protocol VIPs.Jul2020:03:32 likun Keepalived_vrrp[8547]: VRRP_Instance(VI_20)Sending gratuitous ARPs on eth0 for192.168.1.76Jul2020:03:32 likun Keepalived_healthcheckers[8546]:Netlink reflector reports IP 192.168.1.76 addedJul2020:03:49 likun1 Keepalived[7416]:StartingKeepalived v1.2.13(07/20,2014)Jul2020:03:49 likun1 Keepalived[7417]:StartingHealthcheck child process, pid=7418Jul2020:03:49 likun1 Keepalived[7417]:Starting VRRP child process, pid=7419Jul2020:03:49 likun1 Keepalived_vrrp[7419]:Netlink reflector reports IP 192.168.1.21 addedJul2020:03:49 likun1 Keepalived_healthcheckers[7418]:Netlink reflector reports IP 192.168.1.21 addedJul2020:03:49 likun1 Keepalived_healthcheckers[7418]:Netlink reflector reports IP fe80::a00:27ff:fe5d:efc3 addedJul2020:03:49 likun1 Keepalived_healthcheckers[7418]:RegisteringKernel netlink reflectorJul2020:03:49 likun1 Keepalived_healthcheckers[7418]:RegisteringKernel netlink command channelJul2020:03:49 likun1 Keepalived_vrrp[7419]:Netlink reflector reports IP fe80::a00:27ff:fe5d:efc3 addedJul2020:03:49 likun1 Keepalived_vrrp[7419]:RegisteringKernel netlink reflectorJul2020:03:49 likun1 Keepalived_vrrp[7419]:RegisteringKernel netlink command channelJul2020:03:49 likun1 Keepalived_vrrp[7419]:Registering gratuitous ARP shared channelJul2020:03:49 likun1 Keepalived_vrrp[7419]:Opening file ‘/usr/local/keepalived/etc/keepalived.conf‘.Jul2020:03:49 likun1 Keepalived_vrrp[7419]:Configuration is using:62953BytesJul2020:03:49 likun1 Keepalived_vrrp[7419]:UsingLinkWatch kernel netlink reflector...Jul2020:03:49 likun1 Keepalived_vrrp[7419]: VRRP_Instance(VI_21)Entering BACKUP STATEJul2020:03:49 likun1 Keepalived_vrrp[7419]: VRRP sockpool:[ifindex(2), proto(112), unicast(0), fd(10,11)]Jul2020:03:49 likun1 Keepalived_healthcheckers[7418]:Opening file ‘/usr/local/keepalived/etc/keepalived.conf‘.Jul2020:03:49 likun1 Keepalived_healthcheckers[7418]:Configuration is using:11555BytesJul2020:03:49 likun1 Keepalived_healthcheckers[7418]:UsingLinkWatch kernel netlink reflector...Jul2020:03:49 likun1 Keepalived_healthcheckers[7418]:Activating healthchecker for service [192.168.1.21]:3306[root@likun ~]# cat /usr/local/keepalived/etc/keepalived.conf vrrp_script vs_mysql_20 { script "/usr/local/keepalived/checkMySQL.py -h 192.168.1.20 -P 3306" interval 60 }vrrp_instance VI_20 { state BACKUP nopreempt interface eth0 virtual_router_id 21 priority 100 advert_int 5 authentication { auth_type PASS auth_pass 1111 } track_script { vs_mysql_20 } virtual_ipaddress { 192.168.1.76 }} [root@likun1 ~]# cat /usr/local/keepalived/etc/keepalived.conf vrrp_script vs_mysql_21 { script "/usr/local/keepalived/checkMySQL.py -h 192.168.1.21 -P 3306" interval 60 }vrrp_instance VI_21 { state BACKUP nopreempt interface eth0 virtual_router_id 21 priority 90 advert_int 5 authentication { auth_type PASS auth_pass 1111 } track_script { vs_mysql_21 } virtual_ipaddress { 192.168.1.76 }} [root@likun ~]#/usr/local/keepalived/sbin/keepalived -f /usr/local/keepalived/etc/keepalived.conf -D[root@likun ~]# tail -f /var/log/messagesAug 820:58:41 likun Keepalived[8023]:StoppingKeepalived v1.2.13(07/20,2014)Aug 820:59:04 likun Keepalived[8064]:StartingKeepalived v1.2.13(07/20,2014)Aug 820:59:04 likun Keepalived[8065]:StartingHealthcheck child process, pid=8066Aug 820:59:04 likun Keepalived[8065]:Starting VRRP child process, pid=8067Aug 820:59:04 likun Keepalived_vrrp[8067]:Netlink reflector reports IP 192.168.1.20 addedAug 820:59:04 likun Keepalived_vrrp[8067]:Netlink reflector reports IP 10.0.3.15 addedAug 820:59:04 likun Keepalived_vrrp[8067]:Netlink reflector reports IP fe80::a00:27ff:fe00:5857 addedAug 820:59:04 likun Keepalived_healthcheckers[8066]:Netlink reflector reports IP 192.168.1.20 addedAug 820:59:04 likun Keepalived_vrrp[8067]:Netlink reflector reports IP fe80::a00:27ff:fe5d:683a addedAug 820:59:04 likun Keepalived_vrrp[8067]:RegisteringKernel netlink reflectorAug 820:59:04 likun Keepalived_vrrp[8067]:RegisteringKernel netlink command channelAug 820:59:04 likun Keepalived_vrrp[8067]:Registering gratuitous ARP shared channelAug 820:59:04 likun Keepalived_healthcheckers[8066]:Netlink reflector reports IP 10.0.3.15 addedAug 820:59:04 likun Keepalived_healthcheckers[8066]:Netlink reflector reports IP fe80::a00:27ff:fe00:5857 addedAug 820:59:04 likun Keepalived_healthcheckers[8066]:Netlink reflector reports IP fe80::a00:27ff:fe5d:683a addedAug 820:59:04 likun Keepalived_healthcheckers[8066]:RegisteringKernel netlink reflectorAug 820:59:04 likun Keepalived_healthcheckers[8066]:RegisteringKernel netlink command channelAug 820:59:05 likun Keepalived_vrrp[8067]:Opening file ‘/usr/local/keepalived/etc/keepalived.conf‘.Aug 820:59:05 likun Keepalived_healthcheckers[8066]:Opening file ‘/usr/local/keepalived/etc/keepalived.conf‘.Aug 820:59:05 likun Keepalived_vrrp[8067]:Configuration is using:62993BytesAug 820:59:05 likun Keepalived_healthcheckers[8066]:Configuration is using:5287BytesAug 820:59:05 likun Keepalived_vrrp[8067]:UsingLinkWatch kernel netlink reflector...Aug 820:59:05 likun Keepalived_vrrp[8067]: VRRP_Instance(VI_20)Entering BACKUP STATEAug 820:59:05 likun Keepalived_vrrp[8067]: VRRP sockpool:[ifindex(2), proto(112), unicast(0), fd(10,11)]Aug 820:59:05 likun Keepalived_healthcheckers[8066]:UsingLinkWatch kernel netlink reflector...Aug 820:59:07 likun Keepalived_vrrp[8067]: VRRP_Script(vs_mysql_20) succeededAug 820:59:20 likun Keepalived_vrrp[8067]: VRRP_Instance(VI_20)Transition to MASTER STATEAug 820:59:25 likun Keepalived_vrrp[8067]: VRRP_Instance(VI_20)Entering MASTER STATEAug 820:59:25 likun Keepalived_vrrp[8067]: VRRP_Instance(VI_20) setting protocol VIPs.Aug 820:59:25 likun Keepalived_vrrp[8067]: VRRP_Instance(VI_20)Sending gratuitous ARPs on eth0 for192.168.1.76Aug 820:59:25 likun Keepalived_healthcheckers[8066]:Netlink reflector reports IP 192.168.1.76 addedAug 820:59:30 likun Keepalived_vrrp[8067]: VRRP_Instance(VI_20)Sending gratuitous ARPs on eth0 for192.168.1.76[root@likun1 ~]#/usr/local/keepalived/sbin/keepalived -f /usr/local/keepalived/etc/keepalived.conf -D[root@likun1 ~]# tail -f /var/log/messagesAug 918:11:27 likun1 Keepalived[3355]:StartingKeepalived v1.2.13(07/20,2014)Aug 918:11:27 likun1 Keepalived[3356]:StartingHealthcheck child process, pid=3357Aug 918:11:27 likun1 Keepalived[3356]:Starting VRRP child process, pid=3358Aug 918:11:27 likun1 Keepalived_vrrp[3358]:Netlink reflector reports IP 192.168.1.21 addedAug 918:11:27 likun1 Keepalived_healthcheckers[3357]:Netlink reflector reports IP 192.168.1.21 addedAug 918:11:27 likun1 Keepalived_healthcheckers[3357]:Netlink reflector reports IP 10.0.3.15 addedAug 918:11:27 likun1 Keepalived_healthcheckers[3357]:Netlink reflector reports IP fe80::a00:27ff:fe5d:efc3 addedAug 918:11:27 likun1 Keepalived_vrrp[3358]:Netlink reflector reports IP 10.0.3.15 addedAug 918:11:27 likun1 Keepalived_healthcheckers[3357]:Netlink reflector reports IP fe80::a00:27ff:fe97:754a addedAug 918:11:27 likun1 Keepalived_healthcheckers[3357]:RegisteringKernel netlink reflectorAug 918:11:27 likun1 Keepalived_healthcheckers[3357]:RegisteringKernel netlink command channelAug 918:11:27 likun1 Keepalived_vrrp[3358]:Netlink reflector reports IP fe80::a00:27ff:fe5d:efc3 addedAug 918:11:27 likun1 Keepalived_vrrp[3358]:Netlink reflector reports IP fe80::a00:27ff:fe97:754a addedAug 918:11:27 likun1 Keepalived_vrrp[3358]:RegisteringKernel netlink reflectorAug 918:11:27 likun1 Keepalived_vrrp[3358]:RegisteringKernel netlink command channelAug 918:11:27 likun1 Keepalived_vrrp[3358]:Registering gratuitous ARP shared channelAug 918:11:30 likun1 Keepalived_vrrp[3358]:Opening file ‘/usr/local/keepalived/etc/keepalived.conf‘.Aug 918:11:30 likun1 Keepalived_healthcheckers[3357]:Opening file ‘/usr/local/keepalived/etc/keepalived.conf‘.Aug 918:11:30 likun1 Keepalived_vrrp[3358]:Configuration is using:63001BytesAug 918:11:30 likun1 Keepalived_healthcheckers[3357]:Configuration is using:5295BytesAug 918:11:30 likun1 Keepalived_vrrp[3358]:UsingLinkWatch kernel netlink reflector...Aug 918:11:30 likun1 Keepalived_vrrp[3358]: VRRP_Instance(VI_21)Entering BACKUP STATEAug 918:11:30 likun1 Keepalived_vrrp[3358]: VRRP sockpool:[ifindex(2), proto(112), unicast(0), fd(10,11)]Aug 918:11:30 likun1 Keepalived_healthcheckers[3357]:UsingLinkWatch kernel netlink reflector...Aug 918:11:31 likun1 Keepalived_vrrp[3358]: VRRP_Script(vs_mysql_21) succeeded20日志:
Aug 823:09:05 likun Keepalived_vrrp[8067]: VRRP_Script(vs_mysql_20) failedAug 823:09:08 likun Keepalived_vrrp[8067]: VRRP_Instance(VI_20)Entering FAULT STATEAug 823:09:08 likun Keepalived_vrrp[8067]: VRRP_Instance(VI_20) removing protocol VIPs.Aug 823:09:08 likun Keepalived_vrrp[8067]: VRRP_Instance(VI_20)Now in FAULT stateAug 823:09:08 likun Keepalived_healthcheckers[8066]:Netlink reflector reports IP 192.168.1.76 removed21日志:Aug 920:21:00 likun1 Keepalived_vrrp[3358]: VRRP_Instance(VI_21)Transition to MASTER STATEAug 920:21:05 likun1 Keepalived_vrrp[3358]: VRRP_Instance(VI_21)Entering MASTER STATEAug 920:21:05 likun1 Keepalived_vrrp[3358]: VRRP_Instance(VI_21) setting protocol VIPs.Aug 920:21:05 likun1 Keepalived_healthcheckers[3357]:Netlink reflector reports IP 192.168.1.76 addedAug 920:21:05 likun1 avahi-daemon[1320]:Registeringnew address record for192.168.1.76 on eth0.IPv4.Aug 920:21:05 likun1 Keepalived_vrrp[3358]: VRRP_Instance(VI_21)Sending gratuitous ARPs on eth0 for192.168.1.76Aug 920:21:10 likun1 Keepalived_vrrp[3358]: VRRP_Instance(VI_21)Sending gratuitous ARPs on eth0 for192.168.1.76Aug 823:49:05 likun Keepalived_vrrp[8067]: VRRP_Script(vs_mysql_20) succeededAug 823:49:08 likun Keepalived_vrrp[8067]: VRRP_Instance(VI_20)Entering BACKUP STATE
标签:style color io os ar for strong 文件 数据
原文地址:http://www.cnblogs.com/kissdb/p/4009621.html