4. 安装Pacemaker监控软件以及Pacemaker-GUI图形管理工具(可选)。
- tar zxvf ClusterLabs-pacemaker-*
- cd ClusterLabs-pacemaker-*
- ./autogen.sh && ./configure --prefix=$PREFIX --enable-fatal-warnings
- find . -name "Makefile" -exec sed -i 's/-Werror//' {} \;
- make && make install
- cd ..
- ldconfig -v
- tar jxvf Pacemaker-Python-GUI-*
- cd Pacemaker-Python-GUI-*
- ./bootstrap && ./configure --prefix=$PREFIX --enable-fatal-warnings
- find . -name "Makefile" -exec sed -i 's/-Werror//' {} \;
- make && make install
- cd ..
5. 生成随机密钥,配置authkeys文件(权限必须为600)。
- (echo -ne "auth 1\n1 sha1 ";dd if=/dev/urandom bs=512 count=1 | openssl md5) > authkeys
6. 配置文件ha.cf详细说明。
- # debugfile /var/log/ha-debug
- logfile /var/log/ha-log # 指定日志存放位置, 前提必须有写权限
- # logfacility local0
- keepalive 2 # 心跳时间间隔, 也就是节点之间通信的时间间隔
- deadtime 30 # 如果备用节点在30秒内没有收到主节点的心跳信号后, 立刻接管主节点
- warntime 10 # 如果备用节点在10秒内没有收到主节点的心跳信号后, 就会往日志中写入一个警告日志, 但此时不会切换服务
- initdead 120 # 在某些系统上, 系统启动或重启之后需要经过一段时间网络才能正常工作, 该选项用于解决这种情况产生的时间间隔, 取值至少为deadtime的两倍
- udpport 694 # 设置广播通信使用的端口, 694为默认使用的端口号
- # baud 19200
- # serial /dev/ttyS0
- # serial /dev/cuaa0
- # serial /dev/cuad0
- # serial /dev/cua/a
- # bcast eth0
- bcast eth0 eth1 # 指明心跳使用以太网广播方式, 这里使用的是双网卡
- # bcast le0
- # bcast le0 le1
- # mcast eth0 225.0.0.1 694 1 0
- # ucast eth0 10.11.203.2
- auto_failback off # 当备用节点接管资源后, 是否允许主节点在恢复之后进行接管(资源是否允许迁回)
- # stonith baytech /etc/ha.d/conf/stonith.baytech
- # stonith_host * baytech 10.0.0.3 mylogin mysecretpassword
- # stonith_host ken3 rps10 /dev/ttyS1 kathy 0
- # stonith_host kathy rps10 /dev/ttyS1 ken3 0
- # watchdog /dev/watchdog
- node node1.example.com # 主节点主机名, 可以通过命令"uname –n"查看
- node node2.example.com # 备用节点主机名
- # ping 10.11.203.254
- ping_group group1 10.11.203.254 10.13.203.254 # 选择双网卡的网关作为ping节点
- # hbaping fc-card-name
- # respawn userid /path/name/to/run
- # respawn hacluster /usr/lib/heartbeat/ipfail
- respawn hacluster /usr/lib64/heartbeat/ipfail # 指定ping功能的监控脚本
- # apiauth client-name gid=gidlist uid=uidlist
- apiauth ipfail gid=haclient uid=hacluster # 设置监控脚本的运行gid和uid
- # hopfudge 1
- deadping 30 # 节点在30秒内无法ping通指定ping节点, 则认为死亡
- # hbgenmethod time
- # realtime off
- # debug 1
- # apiauth ipfail uid=hacluster
- # apiauth ccm uid=hacluster
- # apiauth cms uid=hacluster
- # apiauth ping gid=haclient uid=alanr,root
- # apiauth default gid=haclient
- # msgfmt classic/netstring
- # use_logd yes/no
- # conn_logd_time 60
- # 传输的数据进行压缩, 可选项
- compression bz2
- compression_threshold 2
- # 开启gui功能, 可选项
- crm respawn
- apiauth mgmtd uid=root
- respawn root /usr/lib64/heartbeat/mgmtd -v
