heartbeat安装与坑

===第一步:安装汇总heartbeat======================
准备工作:
groupadd haclient
useradd -g haclient hacluster
yum install libtool-ltdl-devel
yum install asciidoc


cd Reusable-Cluster-Components-glue--0a7add1d9996/
./autogen.sh
./configure --prefix=/usr/local/heartbeat --with-daemon-user=hacluster --with-daemon-group=haclient --enable-fatal-warnings=no LIBS='/lib64/libuuid.so.1'
make && make install


cd ../resource-agents-3.9.6/
./autogen.sh
./configure --prefix=/usr/local/heartbeat --with-daemon-user=hacluster --with-daemon-group=haclient --enable-fatal-warnings=no LIBS='/lib64/libuuid.so.1'
make && make install


cd ../Heartbeat-3-0-958e11be8686/
./bootstrap
export CFLAGS="$CFLAGS -I/usr/local/heartbeat/include -L/usr/local/heartbeat/lib"
./configure --prefix=/usr/local/heartbeat --with-daemon-user=hacluster --with-daemon-group=haclient --enable-fatal-warnings=no LIBS='/lib64/libuuid.so.1'
make && make install

cp doc/{ha.cf,haresources,authkeys} /usr/local/heartbeat/etc/ha.d/
chkconfig --add heartbeat
chkconfig heartbeat on
chmod 600 /usr/local/heartbeat/etc/ha.d/authkeys
mkdir -pv /usr/local/heartbeat/usr/lib/ocf/lib/heartbeat/
cp /usr/lib/ocf/lib/heartbeat/ocf-* /usr/local/heartbeat/usr/lib/ocf/lib/heartbeat/
ln -svf /usr/local/heartbeat/lib64/heartbeat/plugins/RAExec/* /usr/local/heartbeat/lib/heartbeat/plugins/RAExec/
ln -svf /usr/local/heartbeat/lib64/heartbeat/plugins/* /usr/local/heartbeat/lib/heartbeat/plugins/

systemctl stop firewalld.service
如果不关闭防火墙的话,需要:
systemctl start firewalld.service
iptables -t filter -INPUT -p udp -s 192.168.1.30 -m udp --dport 694 -j ACCEPT


systemctl restart heartbeat
systemctl status heartbeat

--------------------------------------第二步:-配置---------------------------------------------
245:
[root@one1-fst-hx ha.d]# uname -n
one1-fst-hx
eno1: 192.168.1.245


cd /usr/local/heartbeat/etc/ha.d/
#vi ha.cnf
...
ucast eno1 192.168.1.30
auto_failback on //这个可以设置成off
node one1-fst-hx
node one2-fst-hx
ping 192.168.1.1
...


# vi authkeys
auth 1
1 crc
//选择别的认证方式也可以

# vi haresources
one2-fst-hx 192.168.1.177/24/eno1:0

----------------------------------
30:
eno1: 192.168.1.30
# uname -n
one2-fst-hx


cd /usr/local/heartbeat/etc/ha.d/
#vi ha.cnf
ucast eno1 192.168.1.254
其余一样

# vi haresources
one1-fst-hx 192.168.1.177/24/eno1:0


-----配置另一组heartbeat------------------------------------


245
enp5s0: 182.168.1.245

30
eno2: 182.168.1.30


------------第三步:启动--------------------
systemctl enable heartbeat
systemctl start heartbeat
systemctl status heartbeat
--------------------------------
-------------->>>>>>>问题汇总<<<<<<<<<<<<<<<<<-------------------
1,
[root@one2-fst-hx ha.d]# systemctl status heartbeat
7月 04 15:26:13 one2-fst-hx heartbeat[4923]: Jul 04 15:26:13 one2-fst-hx heartbeat: [4923]: ERROR: Illegal directive [ping] in /usr/local/heartbeat/etc/ha.d//ha.cf
7月 04 15:26:13 one2-fst-hx heartbeat[4923]: [4923]: ERROR: Illegal directive [ping] in /usr/local/heartbeat/etc/ha.d//ha.cf

尝试解决1:
去掉 ping 192.168.1.1

网络上的解决方案:
respawn hacluster /usr/local/heartbeat/libexec/heartbeat/ipfail

2, [6189]: ERROR: Illegal directive [ucast] in /usr/local/heartbeat/etc/ha.d//ha.cf
解决方案:
# ln -svf /usr/local/heartbeat/lib64/heartbeat/plugins/RAExec/* /usr/local/heartbeat/lib/heartbeat/plugins/RAExec/
# ln -svf /usr/local/heartbeat/lib64/heartbeat/plugins/* /usr/local/heartbeat/lib/heartbeat/plugins/

3,如果邻居不能建立,而且提示fifo 满了,可能的原因:
防火墙没有关闭


4,都启动后,没有分配vip
原因1:主节点上配置配错了,如下:
one2-fst-hx 192.168.1.177/24/eno1:0
改成:
one1-fst-hx 192.168.1.177/24/eno1:0


5,安装方面:
1),resource-agents-3.9.6
ln: 无法创建符号链接"/usr/lib/ocf/resource.d/heartbeat/.ocf-binaries": 文件已存在
make uninstall
systemctl restart heartbeat


/usr/bin/ld: cannot find -lplumb
解决:
#locate libplumb
#发现/usr/local/heartbeat/目录下有
但是由于拷贝了多个目录,安装多次,所以有问题,删除目录重起电脑

2)安装glue
cd Reusable-Cluster-Components-glue--0a7add1d9996/
/home/asmPackage/heartbeat/Reusable-Cluster-Components-glue--0a7add1d9996/include”
gmake[1]: *** 没有规
解决:yum install libtool-ltdl-devel

gmake[2]: a2x:命令未找到
解决:yum install asciidoc


6,问题:
[20579]: ERROR: should_drop_message: attempted replay attack [one2-fst-hx]? [gen = 1562225811, curgen = 1562596375]

解决1:
rm -f /usr/local/heartbeat/var/lib/heartbeat/hb_generation
rm -f /usr/local/heartbeat/var/lib/heartbeat/hb_uuid
systemctl restart heartbeat

not work


userdel -rf hacluster

groupdel haclient
or
/etc/group


----------------------------


注意:在配置资源的时候
wxy 192.168.1.250/24/eno1:0
不一定完全一样,他的原理是执行本地的可执行文件,比如192.168.1.250/24/eno1:0,对应IpAddr
表示会为本地接口创建一个附属接口名叫xx:0
所以这个接口的配置要跟自己的本地情况一致

另外:
ucast eno1 192.168.1.254
表示用自己的eno1接口去访问192.168.1.254这个ip做心跳检测

mysqldump -hlocalhost -uroot -pwww.huanxing.com -d fstgz>./fstgz.sql

原文地址:https://www.cnblogs.com/shuiguizi/p/11156003.html