学习笔记--heartbeat
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了学习笔记--heartbeat相关的知识,希望对你有一定的参考价值。
Heartbeat
server6 server7
安装包:heartbeat-3.0.4-2.el6.x86_64.rpm
heartbeat-libs-3.0.4-2.el6.x86_64.rpm
heartbeat-devel-3.0.4-2.el6.x86_64.rpm
ldirectord-3.9.5-3.1.x86_64.rpm
rpm -q heartbeat -d 查看配置文件所在位置
cd /etc/ha.d/
cp /usr/share/doc/heartbeat-3.0.4/{ha.cf,haresources,authkeys} .
vim ha.cf
logfacility local0
Keepalice 2
Deadtime 30
Warntime 10
Initdead 60
Udpport 694
Bcast eth0
Auto_failback on
Node server6.example.com
Node server7.example.com
Ping 172.25.60.250
Respawn hacluster /usr/lib64/heartbeat/ipfail
Apiauth ipfail gid=haclient uid=haclient
Vim authkeys
Auth 1
1crc
Chmod 600 authkeys
Vim haresources
Server6.example.com IPaddr::172.25.60.100/24/eth0 httpd
两端开启heartbeat服务
查看运行状态:tail -f /vat/log/messages
drbd
环境:server6 server7 两块大小相同的磁盘vda
安装:drbd-8.4.2.tar.gz
在server6中:
yum install kernel-devel
tar zxf drbd-8.4.2.tar.gz cd drbd-8.4.2
./configure --enable-spec --with-km
mv drbd-8.4.2.tar.gz tpmbuild/sources
rpmbuild -bb drbd.specrpmbuild -bb drbd-km.spec
cd rpmbuild/RPMS/x86_64安装所有生成的包并拷贝至server7中安装
配置:
cd /etc/drbd.d vim example.res
resource example {
meta-disk internal;
device /dev/drbd1;
syncer {
verify-alg sha1;
}
on server6.example.com {
disk /dev/vda;
address 172.25.254.6:7789;
}
on server7.example.com {
disk /dev/vda;
address 172.25.254.7:7789;
}
}
将此配置文件拷贝到server7的同目录下
在两个结点上进行格式化:
/etc/init.d/drbd start
drbdadm create-md example
drbdadm primary example --force
cat /proc/drbd 查看drbd状态
只有primary端才可以挂载
drbdadm secondary example
操作:
drbd-overview
drbdadm up/down example
drbd disconnect example
drbdadm connect --discard-my-data example
整合heartbeat+drbd:
vim /etc/ha.d/haresources
server6.example.com IPaddr::172.25.254.6/24/eth0
drbddisk::example Filesystem::/dev/drbd1::/var/www/html::ext4 httpd
以上是关于学习笔记--heartbeat的主要内容,如果未能解决你的问题,请参考以下文章
Mysql DBA 高级运维学习笔记-heartbeat介绍
Mysql DBA 高级运维学习笔记-heartbeat高可用软件的安装及配置