【源码安装】Heartbeat3.0.9
1.1 关于Heartbeat
1.2 本篇博客实践环境
2. 部署基础环境
2.1 通过YUM安装依赖环境
2.2 创建Heartbeat用户和组
3. 编译安装
3.1下载源码包
3.2 编译安装
3.2.1 编译cluster-glue
3.2.2 编译resource agents
3.2.3 编译安装heartbeat
4.相关文件复制
5.配置和测试
5.1 node11配置
5.2 node12配置
5.3 启动
1.概述
1.1 关于Heartbeat
Heartbeat是Linux-HA工程的组成部分,它实现了一个高可用集群系统。通过Heartbeat可以实现双机热备,以实现服务的持续性。
Heartbeat工作原理:Heartbeat最核心的包括两个部分,心跳监测部分和资源接管部分。心跳监测可以通过网络链路和串口进行,而且支持冗余链路,它们之间相互发送报文来告诉自己当前状态,如果在指定的时间未收到对方发送的报文,那么就认为对方死亡,这时启动资源接管模块来接管运行对方主机上的资源或者服务。
Heartbeat3和Heartbeat2的最大差别在于:3按照模块把原来2拆分成多个子项目,并且提供了一个cluster-glue组件,专门用于ResoureManger的管理。
即:Heartbeat+cluster-glue+resource-agent
1.2 本篇博客实践环境
本篇博客主要在共享存储上安装Heartbeat的主体软件部分,配置部分分别放置在各个需要配置Heartbeat的节点上。由于这种做法,会需要几个特殊的细节处理。
即:将Heartbeat的三类源码包安装在/opt上,然后在node11.node12上进行/etc/heartbeat配置
注:本篇博客参考:http://www.cnblogs.com/knitmesh/p/5439665.html
2. 部署基础环境
2.1 通过YUM安装依赖环境
yum install -y gcc gcc-c++ autoconf automake libnet libtool glib2-devel libxml2-devel bzip2-devel e2fsprogs-devel libxslt-devel libtool-ltdl-devel docbook-dtds docboot-style-xsl
2.2 创建Heartbeat用户和组
注:这里采用了LDAP认证方式,在LDAP服务器上执行一下创建用户和组的操作,在其他节点上都能够认证该用户
groupadd haclient #创建组haclient
useradd -g haclient hacluster -M -s /sbin/nologin #创建用户hacluster
3. 编译安装
3.1下载源码包
yum install -y gcc gcc-c++ autoconf automake libnet libtool glib2-devel libxml2-devel bzip2-devel e2fsprogs-devel libxslt-devel libtool-ltdl-devel docbook-dtds docboot-style-xsl
注:这里采用了LDAP认证方式,在LDAP服务器上执行一下创建用户和组的操作,在其他节点上都能够认证该用户
groupadd haclient #创建组haclient
useradd -g haclient hacluster -M -s /sbin/nologin #创建用户hacluster
3.1下载源码包
Heartbeat的官方地址:http://www.linux-ha.org/wiki/Download
下载Cluster-Glue wget http://hg.linux-ha.org/glue/archive/glue-1.0.9.tar.bz2
下载Resource Agents wget https://github.com/ClusterLabs/resource-agents/tarball/v3.9.2
下载Heartbeat wget http://hg.linux-ha.org/heartbeat-STABLE_3_0/archive/958e11be8686.tar.bz2
3.2 编译安装
3.2.1 编译cluster-glue
#解压
tar -jxvf glue-1.0.9.tar.bz2
#进入解压后的目录
cd Reusable-Cluster-Components-glue--glue-1.0.9
#执行脚本
./autogen.sh
#执行configure
./configure --prefix=/opt/heartbeat/ --sysconfdir=/etc/heartbeat libdir=/opt/heartbeat/lib64 LIBS='/lib64/libuuid.so.1'
#编译
make
#安装
make install
3.2.2 编译resource agents
resource agents就是各种资源的ocf脚本,这些脚本被LRM调用从而实现各种资源的启动,停止,监控等
#解压
tar -zxvf v3.9.2
#进入解压后的目录
cd ClusterLabs-resource-agents-b735277
#执行脚本
./autogen.sh
#执行configure
./configure --prefix=/opt/heartbeat/ --sysconfdir=/etc/heartbeat libdir=/opt/heartbeat/lib64 CFLAGS=-I/opt/heartbeat/include LDFLAGS=-I/opt/heartbeat/lib64 LIBS='/lib64/libuuid.so.1'
#编译
make
#安装
make install
3.2.3 编译安装heartbeat
#解压
tar -jxvf 958e11be8686.tar.bz2
#进入解压目录
cd Heartbeat-3-0-958e11be8686
#执行脚本
./bootstarp
#执行configure
./configure --prefix=/opt/heartbeat --sysconfdir=/etc/heartbeat CFLAGS=-I/opt/heartbeat/include LDFLAGS=-L/opt/heartbeat/lib64 LIBS='/lib64/libuuid.so.1'
#创建库文件链接
ln -s /opt/heartbeat/lib64/\* /lib64
#修改源码文件,否则会make报错
vim /opt/heartbeat/include/heartbeat/glue_config.h,注释或者删除最后一行内容
vim lib/hbclient/Makefile,删掉-Werror字段
#编译
make
#安装
make install
4.相关文件复制
#复制配置源码中的配置文件到配置目录
cp doc/{ha.cf,haresource,authkeys} /etc/heartbeat/ha.d/
#拷贝heartbeat到/etc/init.d目录
#添加服务启动项
chkconfig --add heartbeat
chkconfig heartbeat on
#修改认证文件及属性
chmod 600 authkeys
#修改配置文件中软件启动路径
sed -i 's#/usr/lib/ocf#/opt/heartbeat/usr/lib/ocf#g' /etc/heartbeat/ha.d/shellfuncs
sed -i 's#/usr/lib/ocf#/opt/heartbeat/usr/lib/ocf#g' /etc/heartbeat/ha.d/resource.d/hto-mapfuncs
sed -i 's#/usr/lib/ocf#/opt/heartbeat/usr/lib/ocf#g' /opt/heartbeat/usr/lib/ocf/lib/heartbeat/ocf-shellfuncs
#创建脚本链接
ln -s /opt/heartbeat/usr/lib/ocf /usr/lib/ocf
#测试
service heartbeat status
5.配置和测试
5.1 node11配置
#进入配置目录
cd /etc/heartbeat/ha.d
#修改authkeys,内如如下:
auth 1
1 crc
#编辑ha.cf文件,内容如下:
debugfile /var/log/ha-debug
logfile /var/log/ha-log
logfacility local0
keepalive 2
deadtime 30
warntime 10
initdead 120
udpport 694
ucast eth1 192.168.10.12
auto_failback off
watchdog /dev/watchdog
node node11
node node12
ping 192.168.10.12
respawn hacluster /opt/heartbeat/libexec/heartbeat/ipfail
apiauth ipfail gid=haclient uid=hacluster
#编辑haresources文件,最后一行添加:
node11 192.168.10.100 mysqld
5.2 node12配置
#进入配置目录
cd /etc/heartbeat/ha.d
#修改authkeys,内如如下:
auth 1
1 crc
#编辑ha.cf文件,内容如下:
debugfile /var/log/ha-debug
logfile /var/log/ha-log
logfacility local0
keepalive 2
deadtime 30
warntime 10
initdead 120
udpport 694
ucast eth1 192.168.10.11
auto_failback off
watchdog /dev/watchdog
node node11
node node12
ping 192.168.10.11
respawn hacluster /opt/heartbeat/libexec/heartbeat/ipfail
apiauth ipfail gid=haclient uid=hacluster
#编辑haresources文件,最后一行添加:
node11 192.168.10.100 mysqld
5.3 启动
#复制配置源码中的配置文件到配置目录
cp doc/{ha.cf,haresource,authkeys} /etc/heartbeat/ha.d/
#拷贝heartbeat到/etc/init.d目录
#添加服务启动项
chkconfig --add heartbeat
chkconfig heartbeat on
#修改认证文件及属性
chmod 600 authkeys
#修改配置文件中软件启动路径
sed -i 's#/usr/lib/ocf#/opt/heartbeat/usr/lib/ocf#g' /etc/heartbeat/ha.d/shellfuncs
sed -i 's#/usr/lib/ocf#/opt/heartbeat/usr/lib/ocf#g' /etc/heartbeat/ha.d/resource.d/hto-mapfuncs
sed -i 's#/usr/lib/ocf#/opt/heartbeat/usr/lib/ocf#g' /opt/heartbeat/usr/lib/ocf/lib/heartbeat/ocf-shellfuncs
#创建脚本链接
ln -s /opt/heartbeat/usr/lib/ocf /usr/lib/ocf
#测试
service heartbeat status
5.1 node11配置
#进入配置目录
cd /etc/heartbeat/ha.d
#修改authkeys,内如如下:
auth 1
1 crc
#编辑ha.cf文件,内容如下:
debugfile /var/log/ha-debug
logfile /var/log/ha-log
logfacility local0
keepalive 2
deadtime 30
warntime 10
initdead 120
udpport 694
ucast eth1 192.168.10.12
auto_failback off
watchdog /dev/watchdog
node node11
node node12
ping 192.168.10.12
respawn hacluster /opt/heartbeat/libexec/heartbeat/ipfail
apiauth ipfail gid=haclient uid=hacluster
#编辑haresources文件,最后一行添加:
node11 192.168.10.100 mysqld
5.2 node12配置
#进入配置目录
cd /etc/heartbeat/ha.d
#修改authkeys,内如如下:
auth 1
1 crc
#编辑ha.cf文件,内容如下:
debugfile /var/log/ha-debug
logfile /var/log/ha-log
logfacility local0
keepalive 2
deadtime 30
warntime 10
initdead 120
udpport 694
ucast eth1 192.168.10.11
auto_failback off
watchdog /dev/watchdog
node node11
node node12
ping 192.168.10.11
respawn hacluster /opt/heartbeat/libexec/heartbeat/ipfail
apiauth ipfail gid=haclient uid=hacluster
#编辑haresources文件,最后一行添加:
node11 192.168.10.100 mysqld
5.3 启动
node11上执行:service heartbeat start
node12上执行:service heartbeat start
任何节点上执行:ping 192.168.10.100
【源码安装】Heartbeat3.0.9的更多相关文章
- CentOS7源码安装Redis5.0.4非关系型数据库
源码安装redis-5.0.4 一. 下载redis 1. 需要连接网络 二. 案例(另一种安装方法) [root@localhost ~]# wget http://download.redis.i ...
- 源码安装 qemu-2.0.0 及其依赖 glib-2.12.12
源码安装qemu-2.0.0 下载源代码并解压 http://wiki.qemu-project.org/download/qemu-2.0.0.tar.bz2 .tar.gz 编译及安装: cd q ...
- CentOS下源码安装vsftpd-3.0.0,并设置指定用户访问指定目录(附带完整配置文件)
1.卸载系统已经存在的ftp服务器 因为是源码安装,所以不能通过rpm -qa的方式查看是否已经安装ftp服务器,可以通过find / | grep vsftp*方式查看系统中存在哪些与vsftpd相 ...
- ubuntu16.04下源码安装onos1.0.2
由于工作需要,下载安装onos1.0.2的版本,大家看需求可以下载安装更高级的版本 参考链接:http://www.sdnlab.com/14650.html 1.系统环境 Ubuntu16.04 L ...
- Linux 6.8 源码安装MySQL8.0
搭建环境说明: 系统版本:Red Hat Enterprise Linux Server release 6.8 (Santiago) 内核版本:Linux 2.6.32-642.el6.x86_64 ...
- CentOS7.4 源码安装MySQL8.0
MySQL 8 正式版 8.0.11 已发布,官方表示 MySQL 8 要比 MySQL 5.7 快 2 倍,还带来了大量的改进和更快的性能! 以下为本人2018.4.23日安装过程的记录.整个过程大 ...
- 源码安装zabbix_agent4.0.3
1.源码包下载地址:https://www.zabbix.com/download_sources 2.下载完后上传在任意目录用root用户创建以下脚本server_ip为服务端ip然后执行. gro ...
- 简单说说Ubuntu利用bzr源码安装OpenERP7.0的操作步骤
1.修改Ubuntu国内更新源,具体方法自己baidu.google. 修改更新源后,更新系统 sudo apt-get update sudo apt-get upgrade 复制代码 2.安装Po ...
- centos7源码安装vim8.0
centos 6和7通过yum安装的vim版本仍为7.4,若想尝鲜,可获取源码包编译安装. 准备工作 1.检查vim旧版本,若已存在,将其卸载. $ vim$ yum remove vim* -y 2 ...
- Debian系Linux源码安装Redis5.0.6
一,先在官网下载源码包:https://redis.io/download 二,解压源码包,并cd到解压后的目录: 三,执行make MALLOC=libc: 接着cd src[解压的目录里有这个子目 ...
随机推荐
- JDBC基本使用
J2EE技术规范(二)——JDBC 分类: java2012-12-03 14:25 1060人阅读 评论(8) 收藏 举报 一.了解JDBC (1) JDBC是以统一方式访问数据库的API (2) ...
- Webapck项目开发基本构建及配置
1.创建项目文件夹 myapp 手动创建myapp,或mkdir myapp 2.cd myapp 3.npm init (初始化项目) 4.一路回车(关于项目信息的填写,可以不写,一路回车即可) 可 ...
- JAVA设计模式--学习总结(序)
设计模式(Design pattern)是一套被反复使用的.代码设计经验的总结.使用设计模式是为了可重用代码.让代码更容易被他人理解.保证代码可靠性. 常见的设计模式有23种.分为三大类:创建型模式, ...
- 前端技术之_CSS详解第五天
前端技术之_CSS详解第五天 一.行高和字号 1.1 行高 CSS中,所有的行,都有行高.盒模型的padding,绝对不是直接作用在文字上的,而是作用在“行”上的. <!DOCTYPE html ...
- Opencv3.1+python2.7的CentOS7安装
http://blog.csdn.NET/daunxx/article/details/50506625 转载注释:有些包名和系统包名并不匹配,yum install 找不到的时候,可以yum sea ...
- 全屏slider--swiper
这两年,这种滑动器技术在互联网产品介绍页设计上非常常用,最近某个项目需要这种设计,在网上找了一下,有个老外产的这种设计组件swiper已经非常成熟,原来这个东西设计初衷是pad之类的移动触摸交互设备, ...
- 移动 Web 的用户界面设计
http://www.ibm.com/developerworks/cn/mobile/wa-interface/index.html 简介 在创新者试图探索新的可能性的同时,新兴技术也在经历快速变化 ...
- hadoop配置文件详解系列(一)-core-site.xml篇
接上一个属性,这个属性就是设置阈值的. hadoop.security.groups.cache.secs 300 配置用户组映射缓存时间的,当过期时重新获取并缓存. hadoop.security. ...
- vue实现淘宝商品详情页属性选择功能
方法一是自己想出来的,方法二来自忘记哪里看到的了 不知道是不是你要的效果: 方法一:利用input[type="radio"] css代码: input { display: no ...
- C#高级编程笔记之第一章:.NET体系结构
1.1 C#与.NET的关系 C#不能孤立地使用,必须与.NET Framework一起使用一起考虑. (1)C#的体系结构和方法论反映了.NET基础方法论. (2)多数情况下,C#的特定语言功能取决 ...