[App] rhel7 下安装 Heartbeat 3.0.6
2017-11-08 18:14
309 查看
Heartbeat 项目是 Linux-HA 工程的一个组成部分,它实现了一个高可用集群系统。心跳服务和集群通信是高可用集群的两个关键组件,在
Heartbeat 项目里,由 heartbeat 模块实现了这两个功能。
摘自 <https://baike.baidu.com/item/Heartbeat/16275>
tar包下载地址:
http://linux-ha.org/wiki/Downloads
Heartbeat 3.0.6: http://hg.linux-ha.org/heartbeat-STABLE_3_0/archive/958e11be8686.tar.bz2
Cluster Glue 1.0.12: http://hg.linux-ha.org/glue/archive/0a7add1d9996.tar.bz2
Resource Agents 3.9.6: https://github.com/ClusterLabs/resource-agents/archive/v3.9.6.tar.gz
#
以下
步骤均在 node01 & node02
操作
1、初始化系统
# vi /etc/selinux/config
# systemctl disable firewalld
# hostnamectl set-hostname xxx
# vi /etc/hosts
# reboot
2、Cluster Glue 1.0.12
安装
#
yum -y install glib2-devel libtool-ltdl-devl net-snmp-devel bzip2-devel ncurses-devel openssl-devel libtool libxml2-devel gettext bison flex zlib-devel mailx which libxslt docbook-dtds docbook-style-xsl PyXML shadow-utils opensp autoconf
automake bzip2
#
yum install -y glib2-devel libxml2 libxml2-devel bzip2-devel e2fsprogs-devel libxslt-devel libtool-ltdl-devel make wget docbook-dtds docbook-style-xsl bzip2-devel asciidoc libuuid-devel
#
groupadd haclient
#
useradd -g haclient -M -s /sbin/nologin hacluster
# cd /usr/local/src/
# wget
http://hg.linux-ha.org/glue/archive/0a7add1d9996.tar.bz2
#
bunzip2 0a7add1d9996.tar.bz2
#
tar -xf 0a7add1d9996.tar
# cd
Reusable-Cluster-Components-glue--0a7add1d9996
#
./autogen.sh
#
./configure --prefix=/usr/local/heartbeat && make && make install
3、Resource Agents 3.9.6
安装
# cd /usr/local/src
# wget
https://github.com/ClusterLabs/resource-agents/archive/v3.9.6.tar.gz
#
tar -zxf v3.9.6.tar.gz
#
cd resource-agents-3.9.6
#
./autogen.sh
#
export CFLAGS="$CFLAGS -I/usr/local/heartbeat/include -L/usr/local/heartbeat/lib"
#
./configure --prefix=/usr/local/heartbeat/
#
ln -s /usr/local/heartbeat/lib/* /lib/
#
ln -s /usr/local/heartbeat/lib/* /lib64/
# make && make install
注意:若遇到
metadata-IPv6addr.xml:1: parser error : Document is empty
报错,则重新解压等步骤
4、Heartbeat 3.0.6
安装
# cd /usr/local/src/
# wget
http://hg.linux-ha.org/heartbeat-STABLE_3_0/archive/958e11be8686.tar.bz2
#
bunzip2 958e11be8686.tar.bz2
#
tar -xf 958e11be8686.tar
#
cd Heartbeat-3-0-958e11be8686/
#
./bootstrap
#
./configure --prefix=/usr/local/heartbeat/
# make #
报错
# vi
/usr/local/heartbeat/include/heartbeat/glue_config.h
# make && make install
5、配置
# cd
/usr/local/heartbeat/share/doc/heartbeat
#
cp -a ha.cf authkeys haresources /usr/local/heartbeat/etc/ha.d/
# cd
/usr/local/heartbeat/etc/ha.d
#
chmod 600 etc/ha.d/authkeys
#
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/
# vi ha.cf
# vi
authkeys #
该文件表示发送心跳时
机器用于验证的key的hash算法
双方必须配置成一致的密码
# vi
haresources
6、启动
#
chkconfig heartbeat on
#
systemctl restart heartbeat
# ip a
# tailf
/var/log/ha-log
7、测试
#
停心跳网卡,查看脑裂情况
# down
一个节点,查看 vip
漂移情况
8、进阶
http://blog.csdn.net/linuxchyu/article/details/8096212
Heartbeat 项目里,由 heartbeat 模块实现了这两个功能。
摘自 <https://baike.baidu.com/item/Heartbeat/16275>
tar包下载地址:
http://linux-ha.org/wiki/Downloads
Heartbeat 3.0.6: http://hg.linux-ha.org/heartbeat-STABLE_3_0/archive/958e11be8686.tar.bz2
Cluster Glue 1.0.12: http://hg.linux-ha.org/glue/archive/0a7add1d9996.tar.bz2
Resource Agents 3.9.6: https://github.com/ClusterLabs/resource-agents/archive/v3.9.6.tar.gz
os | rhel7.2 |
node01 | eno16780032 | 192.168.1.151 |
心跳 | ens224 | 10.1.1.1 |
node02 | eno16780032 | 192.168.1.152 |
心跳 | ens224 | 10.1.1.2 |
vip | | 192.168.1.161 |
#
以下
步骤均在 node01 & node02
操作
1、初始化系统
# vi /etc/selinux/config
SELINUX=disabled |
# hostnamectl set-hostname xxx
# vi /etc/hosts
192.168.1.151 mysql-data01 192.168.1.152 mysql-data02 10.1.1.1 priv1 10.1.1.2 priv2 |
# reboot
2、Cluster Glue 1.0.12
安装
#
yum -y install glib2-devel libtool-ltdl-devl net-snmp-devel bzip2-devel ncurses-devel openssl-devel libtool libxml2-devel gettext bison flex zlib-devel mailx which libxslt docbook-dtds docbook-style-xsl PyXML shadow-utils opensp autoconf
automake bzip2
#
yum install -y glib2-devel libxml2 libxml2-devel bzip2-devel e2fsprogs-devel libxslt-devel libtool-ltdl-devel make wget docbook-dtds docbook-style-xsl bzip2-devel asciidoc libuuid-devel
#
groupadd haclient
#
useradd -g haclient -M -s /sbin/nologin hacluster
# cd /usr/local/src/
# wget
http://hg.linux-ha.org/glue/archive/0a7add1d9996.tar.bz2
#
bunzip2 0a7add1d9996.tar.bz2
#
tar -xf 0a7add1d9996.tar
# cd
Reusable-Cluster-Components-glue--0a7add1d9996
#
./autogen.sh
autoconf: autoconf (GNU Autoconf) 2.69 automake: automake (GNU automake) 1.13.4 libtoolize --ltdl --force --copy libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, `.'. libtoolize: copying file `./ltmain.sh' libtoolize: putting auxiliary files in `.'. libtoolize: copying file `libltdl/config/compile' libtoolize: copying file `libltdl/config/config.guess' libtoolize: copying file `libltdl/config/config.sub' libtoolize: copying file `libltdl/config/depcomp' libtoolize: copying file `libltdl/config/install-sh' libtoolize: copying file `libltdl/config/missing' libtoolize: copying file `libltdl/config/ltmain.sh' libtoolize: putting macros in `libltdl/m4'. libtoolize: copying file `libltdl/m4/argz.m4' libtoolize: copying file `libltdl/m4/libtool.m4' libtoolize: copying file `libltdl/m4/ltdl.m4' libtoolize: copying file `libltdl/m4/ltoptions.m4' libtoolize: copying file `libltdl/m4/ltsugar.m4' libtoolize: copying file `libltdl/m4/ltversion.m4' libtoolize: copying file `libltdl/m4/lt~obsolete.m4' libtoolize: putting libltdl files in `libltdl'. libtoolize: `COPYING.LIB' not found in `/usr/share/libtool/libltdl' aclocal autoheader automake --add-missing --include-deps --copy configure.ac:71: warning: AM_INIT_AUTOMAKE: two- and three-arguments forms are deprecated. For more info, see: configure.ac:71: http://www.gnu.org/software/automake/manual/automake.html#Modernize-AM_005fINIT_005fAUTOMAKE-invocation configure.ac:84: installing './compile' configure.ac:28: installing './config.guess' configure.ac:28: installing './config.sub' configure.ac:71: installing './install-sh' configure.ac:71: installing './missing' Makefile.am: installing './INSTALL' lib/clplumbing/Makefile.am:25: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS') lib/clplumbing/Makefile.am: installing './depcomp' lib/lrm/Makefile.am:21: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS') lib/pils/Makefile.am:22: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS') lib/plugins/InterfaceMgr/Makefile.am:22: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS') lib/plugins/compress/Makefile.am:32: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS') lib/plugins/lrm/Makefile.am:25: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS') < 15927 p style="margin:0in;font-family:Calibri;font-size:11pt;">lib/plugins/stonith/Makefile.am:33: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS') lib/stonith/Makefile.am:22: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS') logd/Makefile.am:23: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS') lrm/admin/Makefile.am:36: warning: '%'-style pattern rules are a GNU make extension lrm/admin/Makefile.am:21: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS') lrm/lrmd/Makefile.am:21: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS') lrm/test/Makefile.am:23: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS') replace/Makefile.am:20: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS') autoconf Now run ./configure |
#
./configure --prefix=/usr/local/heartbeat && make && make install
3、Resource Agents 3.9.6
安装
# cd /usr/local/src
# wget
https://github.com/ClusterLabs/resource-agents/archive/v3.9.6.tar.gz
#
tar -zxf v3.9.6.tar.gz
#
cd resource-agents-3.9.6
#
./autogen.sh
autoreconf: Entering directory `.' autoreconf: configure.ac: not using Gettext autoreconf: running: aclocal autoreconf: configure.ac: tracing autoreconf: configure.ac: not using Libtool autoreconf: running: /usr/bin/autoconf autoreconf: running: /usr/bin/autoheader autoreconf: running: automake --add-missing --copy --no-force configure.ac:102: installing './compile' configure.ac:33: installing './config.guess' configure.ac:33: installing './config.sub' configure.ac:83: installing './install-sh' configure.ac:83: installing './missing' heartbeat/Makefile.am: installing './depcomp' autoreconf: Leaving directory `.' Now run ./configure and make |
#
export CFLAGS="$CFLAGS -I/usr/local/heartbeat/include -L/usr/local/heartbeat/lib"
#
./configure --prefix=/usr/local/heartbeat/
#
ln -s /usr/local/heartbeat/lib/* /lib/
#
ln -s /usr/local/heartbeat/lib/* /lib64/
# make && make install
注意:若遇到
metadata-IPv6addr.xml:1: parser error : Document is empty
报错,则重新解压等步骤
4、Heartbeat 3.0.6
安装
# cd /usr/local/src/
# wget
http://hg.linux-ha.org/heartbeat-STABLE_3_0/archive/958e11be8686.tar.bz2
#
bunzip2 958e11be8686.tar.bz2
#
tar -xf 958e11be8686.tar
#
cd Heartbeat-3-0-958e11be8686/
#
./bootstrap
… autoconf Now run ./configure. |
#
./configure --prefix=/usr/local/heartbeat/
# make #
报错
In file included from ../include/lha_internal.h:41:0, from strlcpy.c:1: /usr/local/heartbeat/include/heartbeat/glue_config.h:105:0: error: "HA_HBCONF_DIR" redefined [-Werror] #define HA_HBCONF_DIR "/usr/local/heartbeat/etc/ha.d/" ^ In file included from ../include/lha_internal.h:38:0, from strlcpy.c:1: ../include/config.h:390:0: note: this is the location of the previous definition #define HA_HBCONF_DIR "/usr/local/heartbeat/etc/ha.d" ^ cc1: all warnings being treated as errors gmake[1]: *** [strlcpy.lo] 错误 1 gmake[1]: 离开目录“/usr/local/src/Heartbeat-3-0-958e11be8686/replace” make: *** [all-recursive] 错误 1 |
# vi
/usr/local/heartbeat/include/heartbeat/glue_config.h
#define HA_HBCONF_DIR "/usr/local/heartbeat/etc/ha.d/" # 按下dd将这最后一行删除,保存退出 |
# make && make install
5、配置
# cd
/usr/local/heartbeat/share/doc/heartbeat
#
cp -a ha.cf authkeys haresources /usr/local/heartbeat/etc/ha.d/
# cd
/usr/local/heartbeat/etc/ha.d
#
chmod 600 etc/ha.d/authkeys
#
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/
# vi ha.cf
debugfile /var/log/ha-debug # 保存调试信息文件 logfile /var/log/ha-log # 日志文件 logfacility local0 # 表示使用系统日志 keepalive 2 # 心跳的时间间隔,单位s deadtime 30 # 超出该时间间隔未收到对方节点的心跳,则判定对方死亡 warntime 10 # 超出该时间间隔未收到对方节点的心跳,则发出警告记录到日志中 initdead 120 # 在某系统上,系统启动或重启之后需要经过一段时间网络才能正常工作,该选项用于解决这种情况产生的时间间隔,取值至少为deadtime的2倍 udpport 694 # 设置广播通信使用的端口,694为默认使用的端口号 bcast ens224 # 传播心跳的广播播网卡信息 ucast ens224 10.1.1.2 # node02 配置 10.1.1.1 # 设置对方机器心跳检测的网卡和IP auto_failback on # heartbeat的两台主机分别为主节点和从节点。主节点在正常情况下占用资源并运行所有的服务,遇到故障时把资源交给从节点由从节点运行服务。在该选项设为on的情况下,一旦主节点恢复运行,则 自动获取资源并取代从节点,否则不取代从节点 node mysql-data01 # 配置主从的节点信息 node mysql-data02 ping 192.168.1.1 # ping模式用于测试 如果ping不通 某个主机 就认为当前断网 需要转移vip respawn hacluster /usr/local/heartbeat/libexec/heartbeat/ipfail # 指定与heartbeat一同启动和关闭的进程,该进程被自动监视,遇到故障则重新启动。最常用的进程是ipfail,该进程用于检测和处理网络故障,需要配合ping语句指定的ping node来检测网络连接。如果你的系统是64bit,请注意该文件的路径 apiauth ipfail gid=haclient uid=hacluster # 指定用户&组 |
# vi
authkeys #
该文件表示发送心跳时
机器用于验证的key的hash算法
双方必须配置成一致的密码
auth 2 2 sha1 HI! |
# vi
haresources
mysql-data01 192.168.1.161/24/eno16780032 #说明:mysql-data01 为主节点hostname,192.168.1.161为vip,/24为掩码为24的网段,eno16780032为vip的设备名 |
6、启动
#
chkconfig heartbeat on
#
systemctl restart heartbeat
# ip a
# tailf
/var/log/ha-log
7、测试
#
停心跳网卡,查看脑裂情况
# down
一个节点,查看 vip
漂移情况
8、进阶
http://blog.csdn.net/linuxchyu/article/details/8096212
相关文章推荐
- RHEL5.4 Heartbeat安装(第二部份 测试与监控)
- HA之heartbeat3.0.6安装配置
- RHEL-6.1/5.4安装Heartbeat-3-0-7有可能碰见的各种错误及解决方法
- [App] rhel7 下 安装 JBoss7
- [App] rhel7 下 Weblogic 12C 安装
- RHEL安装heartbeat报错: heartbeat: udpport setting must precede media statements
- RHEL5.4 Heartbeat安装(第一部份 安装)
- Xcode7 模拟器安装app (转)
- ios应用增加给appstore评分和进入app安装页面代码功能
- 【学神-RHEL7】RHEL7.1安装步骤详解
- installshield 制作安装包中执行其他程序LaunchAppAndWait的简介
- RHEL 6.5 编译安装mysql 5.6
- rhel5安装默认语言英语变支持中文
- appium 运行时不重新安装app
- 利用ADB和DOS两者进行手机自动截图传输到电脑上和自动安装APP程序
- 在 RHEL5 或 OL5 64 位 (x86-64) 上安装 Oracle Database 12.1 的要求
- 如何在CentOS/RHEL上安装或升级新的内核版本 推荐
- 用命令行安装并启动Windows Phone 8 App
- RHEL5.4安装配置KVM
- 针对App覆盖安装。