http://8858975.blog.51cto.com/8848975/1786935 node
hamaster 192.168.8.106linux
haslave 192.168.8.119nginx
vip 192.168.8.120c++
gateway 192.168.8.1git
cat /etc/hosts 127.0.0.1 localhost 192.168.8.106 hamaster 192.168.8.119 haslave
依賴包安裝github
yum -y install autoconf automake gcc-c++ asciidoc libxslt-devel libtool libtool-ltdl-devel libxml2 libxml2-devel bzip2-devel glib2-devel mercurial *openssl* net-snmp OpenIPMI flex bison e2fsprogs-devel
2.源碼編譯安裝bootstrap
下載地址:http://linux-ha.org/wiki/Downloadapi
#--Heartbeat 3.0.6: wget http://hg.linux-ha.org/heartbeat-STABLE_3_0/archive/958e11be8686.tar.bz2 #Cluster Glue 1.0.12: wget http://hg.linux-ha.org/glue/archive/0a7add1d9996.tar.bz2 #--Resource Agents 3.9.6: wget https://github.com/ClusterLabs/resource-agents/archive/v3.9.6.tar.gz
3.用戶及用戶組配置
bash
groupadd haclient useradd -g haclient hacluster
4.編譯Cluster Glueide
tar -jxvf cluster-clue-1.0.12.tar.bz2 cd Reusable-Cluster-Components-glue--0a7add1d9996/ ./autogen.sh # 注:32位系統 LIBS='/lib/libuuid.so.1' ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --with-daemon-user=hacluster --with-daemon-group=haclient --enable-fatal-warnings=no LIBS='/lib64/libuuid.so.1' make && make install
卸載
make uninstall && make clean
5.編譯Heartbeat
tar -zxvf resource-agents-3.9.6.tar.gz cd resource-agents-3.9.6 ./autogen.sh ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --with-daemon-user=hacluster --with-daemon-group=haclient --enable-fatal-warnings=no LIBS='/lib64/libuuid.so.1' make && make install
卸載
make uninstall && make clean
6.編譯Heartbeat
tar -jxvf heartbeat-3.0.6.tar.bz2 cd Heartbeat-3-0-958e11be8686/ ./bootstrap export CFLAGS="$CFLAGS -I/usr/local/heartbeat/include -L/usr/local/heartbeat/lib" ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --with-daemon-user=hacluster --with-daemon-group=haclient --enable-fatal-warnings=no LIBS='/lib64/libuuid.so.1' make && make install
卸載
make uninstall && make clean
heartbeat路徑檢查
whereis heartbeat
7.heartbeat配置
cp doc/{ha.cf,haresources,authkeys} /etc/ha.d/ cat /etc/ha.d/authkeys | grep -v ^# | grep -v ^$ auth 3 3 md5 Hello! cat /etc/ha.d/ha.cf | grep -v ^# | grep -v ^$ debugfile /var/log/ha-debug logfile /var/log/ha-log logfacility local0 keepalive 2 deadtime 30 warntime 10 initdead 90 udpport 694 #hamaster配置 ucast eth0 192.168.8.119 #haslave配置 ucast eth0 192.168.8.106 auto_failback on node hamaster node haslave ping 192.168.8.1 respawn hacluster /usr/libexec/heartbeat/ipfail apiauth ipfail gid=hacluster uid=hacluster cat /etc/ha.d/haresources | grep -v ^# | grep -v ^$ hamaster 192.168.8.120/24/eno16777984:0 nginx
8.啓動heartbeat並驗證高可用