HA高可用叢集,HA可用叢集

來源:互聯網
上載者:User

HA高可用叢集,HA可用叢集
 準備2台機器:
主:master:192.168.254.140
從:slave:192.168.254.141vim /etc/hosts主、從:192.168.254.140 master192.168.254.141 slave
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 libnetyum install -y heartbeat
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.cfdebugfile /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.140   #這裡ip對方ip,若是從就是140
auto_failback on
node  master
node  slave
ping 192.168.1.1
respawn hacluster /usr/lib64/heartbeat/ipfail
4.啟動(先主後從)
/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



 

 



聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.