伺服器叢集一般來說有三種:
HA叢集能夠取代磁碟陣列提供叢集節點間熱備;
LB叢集能夠提供動態負載和虛擬機器主機;
HP叢集提供高效能運算叢集。
HA作為高可用性設定組群,為不間斷服務提供保障,這幾天剛好有項目使用Linux叢集,剛好把配置過程記錄一下。以下過程是在archlinux上進行操作。
(1) 安裝Cluster Glue(依賴:libtool、glib2、net-snmp、python、libxml2)
./autogen.sh
./configure
make
make install (root 許可權)
(2) 安裝resource agents
./autogen.sh
./configure
make
make install
(3) 安裝heartbeat
./bootstrap
./ConfigureMe configure(不要直接使用./configure,不知什麼原因這樣會找不到標頭檔)
make
make install(root 許可權)
(4) 配置heartbeat
添加組haclient和使用者hacluster注意兩台機器組和使用者的id要相同
修改/etc/hosts將兩個機器名添加進檔案:
192.168.0.1 node1
192.168.3.109 node1
192.168.0.2 node2
192.168.3.133 node2
修改/etc/ha.d/ha.cf將node節點添加到檔案中,並根據情況修改具體配置節點:
keepalive 2
deadtime 20
inittime 120
udpport 694
bcast eth0(你的廣播網卡,一般來說是eth0)
auto_failback on
node node1
node node2
修改/etc/ha.d/authkeys修改加密方式:
auth 1
1 crc
修改/etc/ha.d/authkeys屬性必須修改為600
修改/etc/ha.d/haresources添加ip自動漂移處理:
node1 Ipaddr::192.168.3.169/24/eth0 mysql httpd
(5) 安裝pacemaker
./autogen.sh
./configure —with-pacemaker —without-ais —without-corosync
make
make install
注意:apiauth 用來設定使用者組
respawn 用來迴圈指令
pacemaker 在python3不能正常運行,需要修改print命令為函數,except的,為as(安裝3.0代碼標準修改)