1.服务器资源配置
2.配置主机名
3.配置hosts
Master和Backup配置相同,如下
cat >>/etc/hosts <<eof 192.168.37.7 data-1-1 192.168.37.8 data-1-2 10.0.10.7 data-1-1 10.0.10.8 data-1-2 eof |
4.添加路由
Master主机:
/sbin/route add -host 10.0.10.8 dev eth2 echo‘/sbin/route add -host 10.0.10.8 dev eth2‘ >> /etc/rc.local |
Backup备机:
/sbin/route add -host 10.0.10.7 dev eth2 echo‘/sbin/route add -host 10.0.10.7 dev eth2‘ >> /etc/rc.local |
5.安装软件包
rpm-ivh epel-release-6-8.noarch.rpm yuminstall heartbeat -y cd /usr/share/doc/heartbeat-3.0.4 cp ha.cf ha.cf.`date +%Y%m%d-%H%M%S` cpha.cf authkeys haresources /etc/ha.d |
6.配置ha.cf文件
echo >ha.cf cat >>ha.cf<<eof #the start by xujh debugfile /var/log/ha-debug logfile /var/log/ha-log logfacility local1 keepalive 2 deadtime 30 warntime 10 initdead 60 #bcast eth2 mcast eth2 225.0.0.181 694 1 0 auto_failback on node data-1-1 node data-1-2 crm no #the end by xujh eof |
7.配置haresource文件
echo >haresources cat >> haresources <<eof #the start by xujh data-1-1 IPaddr::10.0.0.17/24/eth1 data-1-2 IPaddr::10.0.0.18/24/eth1 #the end by xujh eof |
8.配置authkeys文件
chmod 600 authkeys echo > authkeys cat >>authkeys <<eof #the start by xujh auth 1 1 sha147e9336850f1db6fa58bc470bc9b7810eb397f04 #the end by xujh eof |
9.启停heartbeat服务
/etc/init.d/heartbeat start /etc/init.d/heartbeatstop |
10.查看服务