本帖最后由 licengceng 于 2016-1-6 02:19 编辑
以下是在linux上面的操作步骤
下面操作1-5步骤都是在两个机器上操作
1) hostname 设置好,分别为ha1和ha2
ha2 192.168.1.123
ha1 192.168.1.122
主上设置hostname
hostname ha1
vim /etc/sysconfig/network
HOSTNAME=ha1
从上设置hostname
hostname ha2
vim /etc/sysconfig/network
HOSTNAME=ha2
2) 主和从上都操作
iptables -F
service iptables save
主和从都关闭selinux
setenforce 0
sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
3)配置hosts
vi /etc/hosts
192.168.1.123 ha2
192.168.1.122 ha1
4)安装epel扩展源
yum install -y epel-release
5)安装heartbeat
yum install -y heartbeat* libnet nginx
6)主上(ha1)配置
cd /usr/share/doc/heartbeat-3.0.4/
cp authkeys ha.cf haresources /etc/ha.d/
cd /etc/ha.d
vim authkeys
更改或增加一行 3 md5 Hello!
然后修改其权限 # chmod 600 authkeys
编辑haresources文件
vim haresources
加入下面一行 ha1 192.168.1.125/24/eth0:0 nginx
然后编辑ha.cf
vim ha.cf
debugfile /var/log/ha-debug
logfile /var/log/ha-log
logfacility local0
keepalive 2
deadtime 30
warntime 10
initdead 60
udpport 694
ucast eth0 192.168.1.123
auto_failback on
node ha1
node ha2
ping 192.168.1.1
respawn hacluster /usr/lib/heartbeat/ipfail
7)把主上的三个配置拷贝到从上
cd /etc/ha.d/
scp authkeys ha.cf haresources ha2:/etc/ha.d/
8)到从上(ha2) 编辑ha.cf
vi /etc/ha.d/ha.cf
只需要更改一个地方
ucast eth1 192.168.1.123改为ucast eth1 192.168.122
启动heartbeat
先主,后从
service heartbeat start
启动的时候出现问题
[root@ha1 ha.d]# service heartbeat start
Starting High-Availability services: INFO: Resource is stopped
Heartbeat failure [rc=6]. Failed.
heartbeat: udpport setting must precede media statementsheartbeat[24035]: 2016/01/06_01:58:47 ERROR: Client child command [/usr/lib/heartbeat/ipfail] is not executable
heartbeat[24035]: 2016/01/06_01:58:47 ERROR: Heartbeat not started: configuration error.
heartbeat[24035]: 2016/01/06_01:58:47 ERROR: Configuration error, heartbeat not started.
查看日志显示
cat /var/log/ha-log
Jan 06 02:14:20 ha1 heartbeat: [24348]: ERROR: Client child command [/usr/lib/heartbeat/ipfail] is not executable
Jan 06 02:14:20 ha1 heartbeat: [24348]: ERROR: Heartbeat not started: configuration error.
Jan 06 02:14:20 ha1 heartbeat: [24348]: ERROR: Configuration error, heartbeat not started.
在网上找了好久没有找到相关的问题 请大神帮帮忙解决下问题
以下是在linux上面的操作步骤
下面操作1-5步骤都是在两个机器上操作
1) hostname 设置好,分别为ha1和ha2
ha2 192.168.1.123
ha1 192.168.1.122
主上设置hostname
hostname ha1
vim /etc/sysconfig/network
HOSTNAME=ha1
从上设置hostname
hostname ha2
vim /etc/sysconfig/network
HOSTNAME=ha2
2) 主和从上都操作
iptables -F
service iptables save
主和从都关闭selinux
setenforce 0
sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
3)配置hosts
vi /etc/hosts
192.168.1.123 ha2
192.168.1.122 ha1
4)安装epel扩展源
yum install -y epel-release
5)安装heartbeat
yum install -y heartbeat* libnet nginx
6)主上(ha1)配置
cd /usr/share/doc/heartbeat-3.0.4/
cp authkeys ha.cf haresources /etc/ha.d/
cd /etc/ha.d
vim authkeys
更改或增加一行 3 md5 Hello!
然后修改其权限 # chmod 600 authkeys
编辑haresources文件
vim haresources
加入下面一行 ha1 192.168.1.125/24/eth0:0 nginx
然后编辑ha.cf
vim ha.cf
debugfile /var/log/ha-debug
logfile /var/log/ha-log
logfacility local0
keepalive 2
deadtime 30
warntime 10
initdead 60
udpport 694
ucast eth0 192.168.1.123
auto_failback on
node ha1
node ha2
ping 192.168.1.1
respawn hacluster /usr/lib/heartbeat/ipfail
7)把主上的三个配置拷贝到从上
cd /etc/ha.d/
scp authkeys ha.cf haresources ha2:/etc/ha.d/
8)到从上(ha2) 编辑ha.cf
vi /etc/ha.d/ha.cf
只需要更改一个地方
ucast eth1 192.168.1.123改为ucast eth1 192.168.122
启动heartbeat
先主,后从
service heartbeat start
启动的时候出现问题
[root@ha1 ha.d]# service heartbeat start
Starting High-Availability services: INFO: Resource is stopped
Heartbeat failure [rc=6]. Failed.
heartbeat: udpport setting must precede media statementsheartbeat[24035]: 2016/01/06_01:58:47 ERROR: Client child command [/usr/lib/heartbeat/ipfail] is not executable
heartbeat[24035]: 2016/01/06_01:58:47 ERROR: Heartbeat not started: configuration error.
heartbeat[24035]: 2016/01/06_01:58:47 ERROR: Configuration error, heartbeat not started.
查看日志显示
cat /var/log/ha-log
Jan 06 02:14:20 ha1 heartbeat: [24348]: ERROR: Client child command [/usr/lib/heartbeat/ipfail] is not executable
Jan 06 02:14:20 ha1 heartbeat: [24348]: ERROR: Heartbeat not started: configuration error.
Jan 06 02:14:20 ha1 heartbeat: [24348]: ERROR: Configuration error, heartbeat not started.
在网上找了好久没有找到相关的问题 请大神帮帮忙解决下问题
编辑回复