标签:span epel arch icm client sha file attach 启动
准备2台机器:
主:master:192.168.254.140
从:slave:192.168.254.141
1.主上安装:
wget www.lishiming.net/data/attachment/forum/epel-release-6-8_64.noarch.rpm
rpm -ivh epel-release-6-8_64.noarch.rpm
yum install -y libnet
2.编辑HA的3个配置文件
cd /usr/share/doc/heartbeat-3.0.4/
cp authkeys ha.cf haresources /etc/ha.d/
cd /etc/ha.d/
vim authkeys
chmod 600 authkeys
vim haresources
这里的ip是vip:
主从不一样的就是下面这个配置文件:
vim ha.cf
debugfile /var/log/ha-debug
logfile /var/log/ha-log
logfacility local0
keepalive 2
deadtime 30
warntime 10
initdead 60
udpport 649
ucast eth0 192.168.254.141 #这里ip是对方ip,若是从就是140
auto_failback on
node master
node slave
ping 192.168.1.1
respawn hacluster /usr/lib64/heartbeat/ipfail
3.拷贝3个配置到从上
yum install openssh-clients #scp的安装包
scp authkeys haresources ha.cf slave:/etc/ha.d/ #三个配置都是从主上复制过来的
vim ha.cf
debugfile /var/log/ha-debuglogfile /var/log/ha-loglogfacility local0keepalive 2deadtime 30warntime 10initdead 60udpport 649ucast eth0 192.168.254.140 #这里ip对方ip,若是从就是140auto_failback onnode masternode slaveping 192.168.1.1respawn hacluster /usr/lib64/heartbeat/ipfail4.启动(先主后从)
/etc/init.d/heartbeat start
5.测试
主:
echo "11111111111111111master" > /usr/share/nginx/html/index.html
iptables -A INPUT -p icmp -j DROP
iptables -D INPUT -p icmp -j DROP
/etc/init.d/heartbeat stop
从:
echo "2222222222222slave" > /usr/share/nginx/html/index.html
HA高可用集群
标签:span epel arch icm client sha file attach 启动
原文地址:http://www.cnblogs.com/cc-Study/p/6515513.html