Linux高可用叢集方案之配置heartbeat v2基於haresources設定檔的httpd高可用叢集

來源:互聯網
上載者:User

標籤:linux高可用叢集方案之配置heartbeat v2基於haresources設定檔的httpd高可用叢集

本章主要配置heartbeat v2基於haresources設定檔的httpd高可用叢集。

650) this.width=650;" src="http://www.heartbeat.com/wp-content/uploads/2016/05/heartbeat-logo-300x300.png" alt="Heartbeat" style="padding:0px;margin:0px;vertical-align:top;border:none;" />


 ll  本文導航 

  · 前期準備

  · 安裝heartbeat v2

  · node1、node2主機安裝httpd

  · shared-nfs主機安裝nfs

  · 配置httpd高可用叢集

  · 用戶端訪問測試


 ll  要求 

完全掌握heartbeat v2基於haresources設定檔的httpd高可用服務。


  前期準備 

1、heartbeat服務主機規劃

主機 介面 ip 服務 用途
node1.chanedu.com eth0 192.168.1.131

heartbeat

httpd

LAN資料轉寄

eth1 192.168.2.131 心跳資訊鏈路

vip 192.168.1.180

node1.chanedu.com eth0 192.168.1.132

heartbeat

httpd

LAN資料轉寄

eth1 192.168.2.132 心跳資訊鏈路
shared.chanedu.com eth0 192.168.1.150 nfs LAN資料轉寄

2、架構圖

650) this.width=650;" src="https://s1.51cto.com/wyfs02/M00/94/DE/wKioL1kPLzzDNT7dAAIw_DfsRMs892.jpg" title="heartbeat-配置httpd高可用.jpg" width="730" height="448" border="0" hspace="0" vspace="0" alt="wKioL1kPLzzDNT7dAAIw_DfsRMs892.jpg" style="width:730px;height:448px;" />

3、配置yum源

rpm -ivh https://mirrors.ustc.edu.cn/epel/epel-release-latest-6.noarch.rpm


4、同步時間

兩個節點的時間必須一致,可以使用網路時間伺服器或本地ntpd伺服器同步事件,我這裡直接同步處理網路時間伺服器

crontab -e 202.120.2.101


5、節點名稱和IP地址必須能互相解析,保證/etc/hosts檔案中主機名稱的正反解析結果與‘uname -n’的名稱一致

分別在node1和node2中的/etc/hosts添加下面的名稱解析

echo "192.168.1.131    node1.chanedu.com    node1" >> /etc/hostsecho "192.168.1.132    node2.chanedu.com    node2" >> /etc/hosts


6、配置節點心跳串連

node1和node2都使用eth1網卡互相串連,不經過交換器,直接用網線串連node1上的eth1和node2上的eth1,用作心跳檢測

  node1上的eth1:192.168.2.131

  node2上的eth1:192.168.2.132

在node1和node2兩台主機上分別增加一條主機路由,實現兩台主機檢測對端時通過eth1網卡來實現心跳檢測

在node1上添加:

route add -host 192.168.2.132 dev eth1# 這條命令的意思是從node1訪問192.168.2.132(node2),走eth1網卡出去echo "route add -host 192.168.2.132 dev eth1" >> /etc/rc.local

在node2上添加:

route add -host 192.168.2.131 dev eth1# 這條命令的意思是從node1訪問192.168.2.131(node1),走eth1網卡出去echo "route add -host 192.168.2.131 dev eth1" >> /etc/rc.local


7、為了保證通訊安全,節點之間使用ssh密碼的方式進行通訊,可以使用“ssh-keygen -t  rsa”命令產生密鑰。

ssh-keygen -t rsassh-copy-id [email protected]


  安裝heartbeat v2 

由於heartbeat-pils在CentOS-6.5後備cluster-glue取代了,所以需要手動解決依賴關係

1、解決依賴關係

yum install perl-TimeDate net-snmp-libs libnet PyXMLrpm -ivh heartbeat-2.1.4-12.el6.x86_64.rpm heartbeat-pils-2.1.4-12.el6.x86_64.rpm heartbeat-stonith-2.1.4-12.el6.x86_64.rpm


注意:libnet在epel源中


  node1、node2主機安裝httpd 

這裡不示範



  shared主機安裝nfs 

這裡不示範



  配置httpd高可用叢集 



  用戶端訪問測試 


本文出自 “ccschan” 部落格,轉載請與作者聯絡!

Linux高可用叢集方案之配置heartbeat v2基於haresources設定檔的httpd高可用叢集

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.