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


    




你可能感兴趣的:(heartbeat之part03)