改hostname
主:改为master
从:还未slave
vip :192.168.23.110
主从同事执行
vim /etc/hosts
192.168.23.135 master192.168.23.129 slave
yum install -y heartbeat
yum install -y libnet
主上
拷贝模板文件
cd /usr/share/doc/heartbeat-3.0.4/
cp authkeys haresources /etc/ha.d/
编辑
cd /etc/ha.d/
vim authkeys
auth 3#1 crc#2 sha1 HI!3 md5 Hello!
cd /etc/ha.d/
vim haresources
将#node1 10.0.0.170 Filesystem::/dev/sda1::/data1::ext2改为master 192.168.23.110/24/eth0:0 ngin
添加eth0:1网卡
cd /etc/sysconfig/network-scripts/
cp ifcfg-eth0 ifcfg-eth0:1
vim ifcfg-eth0
DEVICE=eth0:1#HWADDR=00:0C:29:11:5B:65TYPE=Ethernet#UUID=aa705bcd-57de-4943-b68c-02bf3d0e1e41ONBOOT=yesNM_CONTROLLED=yesBOOTPROTO=staticIPADDR=192.168.23.134NETMASK=255.255.255.0#GATEWAY=192.168.23.2
/etc/init.d/network restart
ifconfig 查看
cd /etc/ha.d/
-
vim
debugfile /var/log/ha-debuglogfile /var/log/ha-loglogfacility local0keepalive 2deadtime 30warntime 10initdead 60udpport 694ucast eth0 192.168.23.129auto_failback onnode masternode alaveping 192.168.21.1respawn hacluster /usr/lib/heartbeat/ipfail
拷贝到从
scp authkeys haresources slave:/etc/ha.d/
在从上
cd /etc/ha.d/
vim
debugfile /var/log/ha-debuglogfile /var/log/ha-loglogfacility local0keepalive 2deadtime 30warntime 10initdead 60udpport 694ucast eth0 192.168.23.135auto_failback onnode masternode slaveping 192.168.21.1respawn hacluster /usr/lib/heartbeat/ipfail
在主上启动nginx yum install -y nginx
测试
主 /etc/init.d/heartbeat start
从 /etc/init.d/heartbeat start