雙機熱備之--Heartheat配置

,硬件環境

    

 eth0: 對外IP           

        

 eth1: 對內IP(HA專用)           

        

 兩臺主機的eth1使用雙機對聯線直接連接。           

        

 node1: 主機名:0_52 ( gc01 )           

        

 eth0: 192.168.0.52 //對外IP地址           

        

 eth1: 10.0.0.72 //HA心跳使用地址           

        

 node2: 主機名:0_54 ( gc02 )           

        

 eth0: 192.168.0.54 //對外IP地址           

        

 eth1: 10.0.0.74 //HA心跳使用地址

 

,檢查主機的幾個配置文件

 

/etc/hosts            

       

/etc/host.conf           

       

/etc/resolv.conf           

       

/etc/sysconfig/network           

       

/etc/sysconfig/network-scripts/ifcfg-eth0           

       

/etc/sysconfig/network-scripts/ifcfg-eth1           

       

/etc/nsswitch.conf 

  1. #vi /etc/hosts 

node1hosts內容如下:

 

 

  1. 127.0.0.1 localhost.localdomain localhost 

  2. 192.168.0.52 0_52 gc01 

  3. 10.0.0.72 gc01 

  4. 10.0.0.74 gc02 

  5. 192.168.0.54 0_54 

node2hosts內容如下:

 

  1. 127.0.0.1 localhost.localdomain localhost  

  2. 192.168.0.54 0_54 gc02 

  3. 10.0.0.74 gc02  

  4. 10.0.0.72 gc01  

  5. 192.168.0.52 0_52 

 

 

  1. #cat /etc/host.conf 

  2. order hosts,bind 

 

 

 

,安裝 Heartbeat(主從都需安裝)

  1. #yum install -y libnet  

  2. # yum install -y heartbeat-devel  

  3. #yum install -y heartbeat-ldirectord   

  4. #yum install -y heartbeat  

  5.   

  6. #cp /usr/share/doc/heartbeat-2.1.3/ha.cf /etc/ha.d/           

  7. #cp /usr/share/doc/heartbeat-2.1.3/authkeys /etc/ha.d/           

  8. #cp /usr/share/doc/heartbeat-2.1.3/haresources /etc/ha.d/ 

 

 

,配置心跳的加密方式:authkeys (主從相同)

  1. #vi /etc/ha.d/authkeys 

  2. auth 1 

  3. 1 crc 

 

 

 

,配置心跳的監控(主從相同)

  1. #vi /etc/ha.d/haresources             

  2.          

  3. 0_52  192.168.10.200 httpd  

 

 

,配置心跳的配置文件:ha.cf (主從相同)

 

  1. #vi /etc/ha.d/ha.cf             

  2.  

  3. logfile /var/log/ha_log/ha-log.log  

  4.          

  5. bcast eth1  

  6. keepalive 2  

  7.  

  8. warntime 10  

  9.  

  10. deadtime 30  

  11.  

  12. initdead 120  

  13.  

  14. hopfudge 1  

  15.  

  16. udpport 694  

  17.  

  18. auto_failback on   

  19.  

  20. node 0_52 

  21.  

  22. node 0_54 ##節點2

 

 

 

 

,防火牆設置七,防火牆設置

  1. #vi /etc/sysconfig/iptables 

 
  1. #加入以下內容             

  2.          

  3. -A RH-Firewall-1-INPUT -p udp -m udp --dport 694 -d 10.0.0.72 -j ACCEPT 

  1. #/etc/init.d/iptables restart 

 

 

八、

  1. #chkconfig heartheat on 

  2. #chkconfig httpd off 

 

 

 

 

 

 

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章