heartbeat之part03

基本的排錯步驟(從上往下)
ping 127.0.0.1ping的通說明tcp協議棧沒有問題
ping 主機地址 ping的通說明網卡沒有問題
ping 路由器默認網關 ping的通說明包能夠到達路由器
最後 ping DNS服務器地址
安裝heartbeat
 
 
 
 關閉兩臺的防火牆service iptables stop

[root@data-1-1 ~]# yum install heartbeat
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=os error was
12: Timeout on http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=os: (28, 'Connection time-out')
Error: Cannot find a valid baseurl for repo: base

[root@data-1-1 ~]#cd soft
wget http://mirrors.ustc.edu.cn/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm
[root@data-1-1 soft]# ls
epel-release-6-8.noarch.rpm

[root@data-1-2 soft]# rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
[root@data-1-1 soft]# rpm -ivh epel-release-6-8.noarch.rpm
[root@data-1-1 soft]# rpm -qa |grep epel
epel-release-6-8.noarch


[root@data-1-2 ~]# cd soft
[root@data-1-2 soft]# wget http://mirrors.ustc.edu.cn/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm
[root@data-1-2 soft]# ls
epel-release-6-8.noarch.rpm
[root@data-1-2 soft]# rpm -ivh epel-release-6-8.noarch.rpm
warning: epel-release-6-8.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing...                ########################################### [100%]
   1:epel-release           ########################################### [100%]
[root@data-1-2 soft]# rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6

[root@data-1-2 soft]# rpm -qa |grep epel
epel-release-6-8.noarch
[root@data-1-2 soft]# yum install heartbeat* -y 10:13
[root@data-1-2 soft]# ll /etc/ha.d沒裝就沒有
total 20
-rwxr-xr-x. 1 root root  745 Dec  2  2013 harc
drwxr-xr-x. 2 root root 4096 Jan  8 05:23 rc.d
-rw-r--r--. 1 root root  692 Dec  2  2013 README.config
drwxr-xr-x. 2 root root 4096 Jan  8 05:23 resource.d資源的地址
-rw-r--r--. 1 root root 2082 Nov 10 03:00 shellfuncs
[root@data-1-2 soft]# ll /usr/share/doc/heartbeat-3.0.4/模板地址
total 144
-rw-r--r--. 1 root root  1873 Dec  2  2013 apphbd.cf
-rw-r--r--. 1 root root   645 Dec  2  2013 authkeys
-rw-r--r--. 1 root root  3701 Dec  2  2013 AUTHORS
-rw-r--r--. 1 root root 58752 Dec  2  2013 ChangeLog
-rw-r--r--. 1 root root 17989 Dec  2  2013 COPYING
-rw-r--r--. 1 root root 26532 Dec  2  2013 COPYING.LGPL
-rw-r--r--. 1 root root 10502 Dec  2  2013 ha.cf
-rw-r--r--. 1 root root  5905 Dec  2  2013 haresources
-rw-r--r--. 1 root root  2935 Dec  2  2013 README
[root@data-1-2 soft]# cd /usr/share/doc/heartbeat-3.0.4/
[root@data-1-2 heartbeat-3.0.4]# cp ha.cf haresources authkeys /etc/ha.d/
[root@data-1-2 heartbeat-3.0.4]# cd /etc/ha.d/ #若想精通就要看
[root@data-1-2 ha.d]# less ha.cf
ha.cf詳細說明
debugfile /var/log/ha-debug調試日誌存放位置
logfile  /var/log/ha/ha-log日誌存放位置
logfacility    local在syslog服務中配置經過local設備接收日誌
keepalive 2    指定心跳間隔爲2秒
deadtime 30    指定備用節點在30秒內沒有收到主節點的信號,就接收主機的資源
warntime 10    指定心跳延遲的時間爲10秒,當10秒鐘內備份不能收到主節點的心跳信號時,就往日誌
中寫入一個警告日誌,此時不會切換業務
initdead 120   指定heartbeart首次運行後,須要等待120秒才啓動主服務器
任何資源,改選項用於解決這種事情產生的時間間隔值,取值至少deadline的
兩倍,宕機啓動時會遇到綁定很慢,爲正常現象,這時改值長的緣由
#bcast eth指定心跳使用以太網廣播方式進行廣播,如使用兩個實際網絡
來傳遞心跳則#bcast eth0 eth1
mcast eth2 225.0.0.1 694 10 694是端口
auto_failback_on 用來定義主節點恢復後,是否將資源服務自動切回
node data-1-1 主機節/點主機名,能夠經過uname -n查看
node data-1-2備用節點名
crm no是否開啓cluster resource manager集羣資源管理功能

authkey權限必須600
能夠設置的認證方法crc,shal(比較好),md5
ha.cnf
debugfile /var/log/ha-debug
logfile /var/log/ha-log
logfacility     local1
keepalive 2
warntime 10
initdead 60
mcast eth1 225.0.0.1 694 1 0
auto_failback on
node    data-1-1
crm no

[root@data-1-2 ha.d]# vi haresources
data-1-1 IPaddr::192.168.0.7/24/eth0
data-1-2 IPaddr::192.168.0.8/24/eth0


root@data-1-2 ha.d]# vi authkeys
auth 3
#1 crc
#2 sha1 HI!
3 md5 Hello!

[root@data-1-2 ha.d]# scp ha.cf haresources authkeys root@data-1-1:~/soft
[root@data-1-2 ha.d]# chmod 600 authkeys

[root@data-1-1 soft]#  cd /usr/share/doc/heartbeat-3.0.4/
[root@data-1-1 soft]# cp authkeys ha.cf haresources /etc/ha.d/
[root@data-1-1 soft]# cd /etc/ha.d/
[root@data-1-1 ha.d]# chmod 600 authkeys
[root@data-1-1 ha.d]# /etc/init.d/heartbeat start
[root@data-1-1 ha.d]# ip add|grep 192.168
    inet 192.168.0.117/24 brd 192.168.0.255 scope global eth1
    inet 192.168.0.107/24 brd 192.168.0.255 scope global eth0
    inet 192.168.0.108/24 brd 192.168.0.255 scope global secondary eth0

[root@data-1-2 ha.d]# /etc/init.d/heartbeat start
[root@data-1-2 ha.d]# cat /var/log/ha-log
Jan 08 06:59:52 data-1-2 heartbeat: [28122]: info: Pacemaker support: no
Jan 08 06:59:52 data-1-2 heartbeat: [28122]: WARN: Logging daemon is disabled --enabling logging daemon is recommended
Jan 08 06:59:52 data-1-2 heartbeat: [28122]: info: **************************
Jan 08 06:59:52 data-1-2 heartbeat: [28122]: info: Configuration validated. Starting heartbeat 3.0.4
Jan 08 06:59:52 data-1-2 heartbeat: [28123]: info: heartbeat: version 3.0.4
Jan 08 06:59:52 data-1-2 heartbeat: [28123]: WARN: No Previous generation - starting at 1452265193
Jan 08 06:59:52 data-1-2 heartbeat: [28123]: info: Heartbeat generation: 1452265193
Jan 08 06:59:52 data-1-2 heartbeat: [28123]: info: No uuid found for current node - generating a new uuid.
Jan 08 06:59:52 data-1-2 heartbeat: [28123]: info: Creating FIFO /var/lib/heartbeat/fifo.
Jan 08 06:59:52 data-1-2 heartbeat: [28123]: info: glib: UDP multicast heartbeat started for group 225.0.0.1 port 694 interface eth0 (ttl=1 loop=0)
Jan 08 06:59:52 data-1-2 heartbeat: [28123]: info: G_main_add_TriggerHandler: Added signal manual handler
Jan 08 06:59:52 data-1-2 heartbeat: [28123]: info: G_main_add_TriggerHandler: Added signal manual handler
Jan 08 06:59:52 data-1-2 heartbeat: [28123]: info: G_main_add_SignalHandler: Added signal handler for signal 17
Jan 08 06:59:52 data-1-2 heartbeat: [28123]: info: Local status now set to: 'up'
Jan 08 06:59:53 data-1-2 heartbeat: [28123]: info: Link data-1-1:eth0 up.
Jan 08 06:59:53 data-1-2 heartbeat: [28123]: info: Status update for node data-1-1: status active
harc(default)[28132]:    2016/01/08_06:59:53 info: Running /etc/ha.d//rc.d/status status
[root@data-1-2 ha.d]# ip add|grep 192.168
    inet 192.168.0.118/24 brd 192.168.0.255 scope global eth1
    inet 192.168.0.108/24 brd 192.168.0.255 scope global eth0
這是因爲data-1-1防火牆沒有關
[root@data-1-1 ha.d]#  service iptables stop
這時再重啓兩臺heartbeat
若出現below就ifup eth1
eartbeat[29308]: 2016/01/08_07:17:31 ERROR: glib: Unable to retrieve local interface address for interface [eth0] using ioctl(SIOCGIFADDR): Cannot assign requested address
heartbeat[29308]: 2016/01/08_07:17:31 ERROR: glib: mcast device [eth0] is invalid or not set up properly
heartbeat[29308]: 2016/01/08_07:17:31 info: Pacemaker support: no
heartbeat[29308]: 2016/01/08_07:17:31 ERROR: Heartbeat not started: configuration error.
heartbeat[29308]: 2016/01/08_07:17:31 ERROR: Configuration error, heartbeat not started.
正常時候
[root@data-1-1 ha.d]# ip addr|grep 192.168
    inet 192.168.0.117/24 brd 192.168.0.255 scope global eth1
    inet 192.168.0.107/24 brd 192.168.0.255 scope global eth0
    [root@data-1-2 ha.d]# ip addr|grep 192.168
    inet 192.168.0.118/24 brd 192.168.0.255 scope global eth1
    inet 192.168.0.108/24 brd 192.168.0.255 scope global eth0


    




node

相關文章
相關標籤/搜索