keepalivedは心拍数テストにのみ使用されます

3694 ワード

keepalived -2011-12-10
##################################################################
 :

vip: 192.168.33.222
mas: 192.168.33.220
sla: 192.168.33.221

 :
keepalived-1.1.18.tar.gz
##################################################################
yum install openssl-devel

tar zxvf keepalived-1.1.18.tar.gz
cd keepalived-1.1.18
./configure
make
make install
cd ..

cp /usr/local/etc/rc.d/init.d/keepalived /etc/rc.d/init.d/
cp /usr/local/etc/sysconfig/keepalived /etc/sysconfig/
mkdir /etc/keepalived
cp /usr/local/etc/keepalived/keepalived.conf /etc/keepalived/
cp /usr/local/sbin/keepalived /usr/sbin/ 
service keepalived start


 .
[root@slave init.d]# chkconfig keepalived on
[root@slave init.d]# chkconfig --list | grep keepalivd
[root@slave init.d]# chkconfig --list | grep keep     
keepalived     	0:off	1:off	2:on	3:on	4:on	5:on	6:off


######################################################################
 :
 yum install  sysklogd syslog-n rsyslog

vi /etc/rsyslog.conf

 :

# Provides UDP syslog reception                                                                            
$ModLoad imudp                                                                                                        

          
$UDPServerRun 514                                                                                                     

      
$UDPServerAddress 127.0.0.1  

*.info;mail.none;authpriv.none;cron.none;local3.none                /var/log/messages


local3.*    /var/log/haproxy/haproxy.log

#keepalived -S 0
local0.*	/var/log/keepalived/keepalived.log

 /sbin/rsyslogd -i /var/run/syslogd.pid -c 5 

[root@master ~]# netstat -na | grep  514
udp        0      0 0.0.0.0:514                 0.0.0.0:*                               
udp        0      0 :::514                      :::*                                    
unix  3      [ ]         STREAM     CONNECTED     16514  @/

[root@master keepalived]# /usr/local/sbin/keepalived -D -d -S 0
[root@master keepalived]# ps -ef | grep keep
root      5201     1  0 23:49 ?        00:00:00 /usr/local/sbin/keepalived -D -d -S 0
root      5202  5201  0 23:49 ?        00:00:00 /usr/local/sbin/keepalived -D -d -S 0
root      5203  5201  0 23:49 ?        00:00:00 /usr/local/sbin/keepalived -D -d -S 0

   
------------------------------------------------------------------


 :

global_defs {
    router_id MySQL-ha
 }
  
 vrrp_instance VI_1 {
     state BACKUP
     interface eth0
     virtual_router_id 60
     priority 100
     advert_int 1
#  
    nopreempt
     authentication {
         auth_type PASS
         auth_pass 1111
     }
  
     virtual_ipaddress {
         192.168.33.222/24
     }
 }





 :

global_defs {
    router_id MySQL-ha
 }
  
  
 vrrp_instance VI_1 {
     state BACKUP
     interface eth0
     virtual_router_id 60
     priority 90
     advert_int 1
     nopreempt
     authentication {
         auth_type PASS
         auth_pass 1111
     }
  
     virtual_ipaddress {
         192.168.33.222/24
     }
 }


 :
mysql> show variables like '%read_only%';
+------------------+-------+
| Variable_name    | Value |
+------------------+-------+
| innodb_read_only | OFF   |
| read_only        | ON    |
| tx_read_only     | OFF   |
+------------------+-------+
3 rows in set (0.02 sec)




 :
Jun 18 14:11:04 test Keepalived_vrrp[1663]: ip address associated with VRID not present in received packet : 192.168.32.66
Jun 18 14:11:04 test Keepalived_vrrp[1663]: one or more VIP associated with VRID mismatch actual MASTER advert
Jun 18 14:11:04 test Keepalived_vrrp[1663]: bogus VRRP packet received on eth1 !!!



  virtual_router_id 51  60 , 51 ID