heartbeat 编译安装、配置

CentOS 6.6  x64

HA1:192.168.137.128

HA2:192.168.137.129

VIP:192.168.137.100

资源:http://download.csdn.net/download/yang_xu_1987/10205320  

Heartbeat 3.0.6.tar.bz2
Cluster Glue 1.0.12.tar.bz2
resource-agents-3.9.6.tar.gz


HA1配置:

#安装相关包

yum install gcc gcc-c++ autoconf automake libtool glib2-devel libxml2-devel bzip2 bzip2-devel e2fsprogs-devel libxslt-devel libtool-ltdl-devel asciidoc -y

#安装pacemaker

yum install -y pacemaker       

#安装http测试服务器

yum install httpd -y

#开启服务

service httpd start

#创建用户和组

groupadd haclient
useradd -g haclient hacluster

#安装cluster-clue

tar -jxvf Cluster\ Glue\ 1.0.12.tar.bz2
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

#安装resource-agents

cd ..

tar -zxvf resource-agents-3.9.6.tar.gz
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   

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

报错信息:

ln: 创建符号链接 "/usr/lib/ocf/resource.d/heartbeat/.ocf-binaries": 文件已存在
gmake[3]: *** [install-exec-local] 错误 1
gmake[3]: Leaving directory `/tmp/download/resource-agents-3.9.6'
gmake[2]: *** [install-am] 错误 2
gmake[2]: Leaving directory `/tmp/download/resource-agents-3.9.6'
gmake[1]: *** [install-recursive] 错误 1
gmake[1]: Leaving directory `/tmp/download/resource-agents-3.9.6'
make: *** [install] 错误 2

解决方式:make uninstall && make install

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


#安装heartbeat

cd ..
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/local/heartbeat --with-daemon-user=hacluster --with-daemon-group=haclient --enable-fatal-warnings=no LIBS='/lib64/libuuid.so.1'
make && make install


#拷贝配置文件到相关目录

cp /usr/local/heartbeat/share/doc/heartbeat/{ha.cf,haresources,authkeys} /usr/local/heartbeat/etc/ha.d/

#配置权限,安全性

chmod 600 /usr/local/heartbeat/etc/ha.d/authkeys

#修改配置文件

cd /usr/local/heartbeat/etc/ha.d/

vi ha.cf

debugfile /var/log/ha-debug  #开启调试信息

logfile /var/log/ha-log   #开启日志

keepalive 2  #设定心跳时间

deadtime 30   #无心跳信号后反应时间

warntime 10   #心跳延时时间

initdead 120   #系统预留的忽略时间段

mcast eth0 225.0.0.1 694 1 0   #多播方式

auto_failback on #节点恢复后是否切回

node node1 #主节点

node node2 #备用节点

ping 192.168.137.1 #测试本机网络是否正常

respawn hacluster /usr/local/heartbeat/libexec/heartbeat/ipfail   #指定和heartbeat一起的进程


vi haresources

node1  IPaddr::192.168.137.100/24/eth0  #指定vip


vi authkeys

#指定加密方式

auth 3
3 md5 password #自定义密码


#开机自启

chkconfig --add heartbeat

chkconfig heartbeat on


#拷贝相关资源

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/


#启动heartbeat前准备

#配置主机名

vi /etc/sysconfig/network  #重启后生效

HOSTNAME=node1#名称为node1          HA2 配置为node2

#解析节点名

vi /etc/hosts#加入两行

192.168.137.128 node1
192.168.137.129 node2

#同步时间

yum install ntp -y  #安装ntp服务

service ntpd start   #开启nfp

ntpdate 192.168.1.211  #同步时间

#双机无密通讯

ssh-keygen -t rsa -f ~/.ssh/id_rsa -P ''
ssh-copy-id -i ~/.ssh/id_rsa.pub root@192.168.137.129  #HA2配置后面地址为192.168.137.128

#配置子网卡

 ifconfig eth0:0 192.168.137.100 netmask 255.255.255.0 up

#开启heartbeat服务

service heartbeat start


HA2配置同上


进入web地址:http://192.168.137.100/




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值