联系:手机/微信(+86 17813235971) QQ(107644445)
作者:惜分飞©版权所有[未经本人同意,不得以任何形式转载,否则有进一步追究法律责任的权利.]
一、heartbeat
1、安装heartbeat
见Heartbeat安装及简单配置
2、配置参数
2.1)/etc/ha.d/ha.cf
logfile /var/log/ha-log
keepalive 2
deadtime 30
warntime 10
initdead 120
udpport 694
ucast eth1 10.10.10.2
auto_failback off
watchdog /dev/watchdog
node node1
node node2
ping 192.168.1.1
respawn hacluster /usr/lib/heartbeat/ipfail
2.2)/etc/ha.d/haresources
node1 IPaddr::192.168.1.100/24/eth0/ drbddisk Filesystem::/dev/drbd0::/opt/mysql::ext3 mysql
2.3)/etc/ha.d/authkeys
auth 1
1 crc
二、DRBD
1、DRBD安装
见DRBD安装配置说明
2、/etc/drbd.conf
global { usage-count yes; } common { syncer { rate 10M; } } resource r0 { protocol C; disk { on-io-error detach; } net { after-sb-0pri disconnect; after-sb-1pri disconnect; after-sb-2pri disconnect; rr-conflict disconnect; } on node1 { device /dev/drbd0; disk /dev/sdb1; address 10.10.10.1:7788; meta-disk internal; } on node2 { device /dev/drbd0; disk /dev/sdb1; address 10.10.10.2:7788; meta-disk internal; } }
三、mysql
1、mysql安装
见mysql 5.5二进制文件安装
四、服务配置
1、配置mysql服务器(不要设置开机启动,由heartbeat控制)
修改mysql.server文件
basedir=/opt/mysql/product/5.5
datadir=/opt/mysql/mysqldata
mv /opt/mysql/product/5.5/support-files/mysql.server /etc/init.d/mysql
2、配置heartbeat
chkconfig –add heartbeat
chkconfig heartbeat on
[root@node2 ~]# chkconfig –list drbd
drbd 0:关闭 1:关闭 2:启用 3:启用 4:启用 5:启用 6:关闭
drbd使用rpm包安装,处于开机启动状态(如果不是需要人工配置)