为了账号安全,请及时绑定邮箱和手机立即绑定

Heartbeat+Drbd+MySQL 安装部署

标签:
MySQL


测试环境 1.1测试环境

DB主机:

CentOS 5.5 x86_64

Eth0:192.168.20.63/24

Eth1:10.0.0.63/24

DB备机:

CentOS 5.5 x86_64

Eth0:192.168.20.64/24

Eth1:10.0.0.64/24

1.2拓扑图

clip_image002

Drbd安装配置

2.1配置安装

2.1.1安装Drbd

rpm -ivh drbd82-8.2.6-1.el5.centos.x86_64.rpm

rpm -ivh kmod-drbd82-8.2.6-2.x86_64.rpm

2.1.2修改相关配置文件

(1)修改/etc/hosts文件

cat>>/etc/hosts<<EOF

192.168.20.63 serverC.cyhd.com.cn

192.168.20.64 serverD.cyhd.com.cn

EOF

(2)修改Drbd配置文件

cat /etc/drbd.conf

global { usage-count yes; }

common { syncer { rate 100M; } }#DRBD8.2 的rate 最高支持700Mbps

resource r0 {

protocol C;

startup {

}

disk {

on-io-error detach;

}

net {

cram-hmac-alg sha1;

shared-secret "cy2009";

}

on serverC.cyhd.com.cn {#on 后面写机器的hostname

device /dev/drbd0;

disk /dev/sdb5;

address 192.168.20.63:7789;

meta-disk internal;

}

on serverD.cyhd.com.cn {#on 后面写机器的hostname

device /dev/drbd0;

disk /dev/sdb5;

address 192.168.20.64:7789;

meta-disk internal;

}

}

(3)在两台机器上创建drbd设备

[root@serverC ~]# drbdadm create-md r0

v08 Magic number not found

v07 Magic number not found

v07 Magic number not found

v08 Magic number not found

Writing meta data...

initialising activity log

NOT initialized bitmap

New drbd meta data block sucessfully created.

success

[root@serverD ~]# drbdadm create-md r0

v08 Magic number not found

v07 Magic number not found

v07 Magic number not found

v08 Magic number not found

Writing meta data...

initialising activity log

NOT initialized bitmap

New drbd meta data block sucessfully created.

success

(4)启动DRBD

[root@serverC ~]# /etc/init.d/drbd start

Starting DRBD resources: [ d(r0) s(r0) n(r0) ].

[root@serverD ~]# /etc/init.d/drbd start

Starting DRBD resources: [ d(r0) s(r0) n(r0) ].

(5)两台机器Drbd状态

[root@serverC ~]# cat /proc/drbd

version: 8.2.6 (api:88/proto:86-88)

GIT-hash: 3e69822d3bb4920a8c1bfdf7d647169eba7d2eb4 build by buildsvn@c5-x8664-build, 2008-10-03 11:30:17

0: cs:Connected st:Secondary/Secondary ds:Inconsistent/Inconsistent C r---

ns:0 nr:0 dw:0 dr:0 al:0 bm:0 lo:0 pe:0 ua:0 ap:0 oos:10481992

[root@serverD ~]# cat /proc/drbd

version: 8.2.6 (api:88/proto:86-88)

GIT-hash: 3e69822d3bb4920a8c1bfdf7d647169eba7d2eb4 build by buildsvn@c5-x8664-build, 2008-10-03 11:30:17

0: cs:Connected st:Secondary/Secondary ds:Inconsistent/Inconsistent C r---

ns:0 nr:0 dw:0 dr:0 al:0 bm:0 lo:0 pe:0 ua:0 ap:0 oos:10481992

"/proc/drbd"中显示了drbd当前的状态.第一行的st表示两台主机的状态,都是"备机"状态.

ds是磁盘状态,都是"不一致"状态.

这是由于,DRBD无法判断哪一方为主机,以哪一方的磁盘数据作为标准数据.所以,我们需要初始化

将serverC升为主机

在serverC上执行:

[root@serverC ~]# drbdsetup /dev/drbd0 primary –o

主备机状态分别是"主/备",主机磁盘状态是"实时",备机状态是"不一致".

在第3行,可以看到数据正在同步中,即主机正在将磁盘上的数据,传递到备机上.现在的进度是[>...................] sync'ed: 0.4% (1040316/1040316)K

稍等一会,在数据同步完后,再查看一下ha1的DRBD状态:

磁盘状态都是"实时",表示数据同步完成了.

你现在可以把主机上的DRBD设备挂载到一个目录上进行使用.备机的DRBD设备无法被挂载,因为它是用来接收主机数据的,由DRBD负责操作.

在serverC执行

[root@serverC ~]# mkfs.ext3 /dev/drbd0 //网上这里有很多不同的版本,具体drbd深入我还没有研究,我现在安装的版本是只要在第一台上面格式化文件系统,他会自动传过去。如果你在serverD上格式化,他会提示出错,而且格式化要在上面相应工作做完以后才可以到这一步。

3.2切换测试

写入测试数据:

[root@serverC ~]# mount /dev/drbd0 /mnt

[root@serverC ~]# touch /mnt/matthew

[root@serverC ~]# ls

matthew lost+found

DRBD的主备机切换有时,你需要将DRBD的主备机互换一下.可以执行下面的操作:

在主机上,先要卸载掉DRBD设备

将主机降级为"备机"

[root@serverC ~]# umount /mnt

[root@serverC ~]# drbdadm secondary r0

[root@serverC ~]#cat /proc/drbd

version: 8.2.6 (api:88/proto:86-88)

GIT-hash: 3e69822d3bb4920a8c1bfdf7d647169eba7d2eb4 build by buildsvn@c5-i386-build, 2008-10-03 11:42:320: cs:Connected st:Secondary/Primary ds:UpToDate/UpToDate C r---

ns:8650688 nr:24 dw:265108 dr:8385749 al:105 bm:584 lo:0 pe:0 ua:0 ap:0 oos:0

现在,两台主机都是"备机".

在备机serverD上,将它升级为"主机".

[root@serverD ~]#drbdadm primary r0

[root@serverD ~]# cat /proc/drbdversion: 8.2.6 (api:88/proto:86-88)

GIT-hash: 3e69822d3bb4920a8c1bfdf7d647169eba7d2eb4 build by buildsvn@c5-i386-build, 2008-10-03 11:42:320: cs:Connected strimary/Secondary ds:UpToDate/UpToDate C r---

ns:0 nr:32 dw:32 dr:0 al:0 bm:0 lo:0 pe:0 ua:0 ap:0 oos:0

现在serverD成为主机了。

查看备机目录下内容

[root@serverD ~]# mount /dev/drbd0 /mnt

[root@serverD mnt]#ll /mnt

total 16

-rw-r--r-- 1 root root 0 Mar 19 11:02 matthew

drwx------ 2 root root 16384 Mar 19 11:01 lost+found

可以看到,在主机serverC上产生的文件matthew,也完整的保存在备机serverD的DRBD分区上.这就是DRBD的网络RAID-1功能. 在主机上的任何操作,都会被同步到备机的相应磁盘分区上,达到数据备份的效果.

Heartbeat配置安装

3.1配置安装heartbeat

3.1.1安装heartbeat

rpm -ivh heartbeat-2.1.3-3.el5.centos.x86_64.rpm

rpm -ivh heartbeat-pils-2.1.3-3.el5.centos.x86_64.rpm

rpm -ivh heartbeat-stonith-2.1.3-3.el5.centos.x86_64.rpm

3.1.2修改相关配置文件

(1)拷贝/usr/share/doc/heartbeat-2.1.3/ 下面的ha.cf,authkeys,haresources 到/etc/ha.d 目录下

cp /usr/share/doc/heartbeat-2.1.3/haresources /etc/ha.d

cp /usr/share/doc/heartbeat-2.1.3/ha.cf /etc/ha.d

cp /usr/share/doc/heartbeat-2.1.3/authkeys /etc/ha.dcd /etc/ha.d

(2)authkeys文件中下面两行前面的#号去掉

vi authkeys

auth 1

1 crc

:wq

chmod 600 authkeys

(3)配置/etc/ha.d/ha.cf

debugfile /var/log/ha-debug #调试日志文件

logfile /var/log/ha-log #系统运行日志文件

logfacility local0 #日志记录等级

keepalive 2 #心跳频率,2表示2秒;200ms则表示200毫秒

deadtime 10 #节点死亡时间,就是过了10秒后还没有收到心跳就认为主节点死亡

warntime 5 #告警时间

initdead 120 #初始化时间

udpport 694 #心跳信息传递的udp端口

#bcast eth1 #采用udp广播播来通知心跳,建议在备用节点不只一台时使用

#mcast eth1 225.0.0.1 694 1 0 #采用udp多播来通知心跳,建议在备用节点不只一台时使用

ucast eth1 10.0.0.64 #采用udp单播来通知心跳,注意:这一项在2个节点IP

auto_failback on

#如果主节点重新恢复过来,主节点将主动将资源抢占过来,如果为off,则只当备用节点当掉后,主节点才取回资源

watchdog /dev/watchdog

#看门狗。如果本节点在超过1分钟后还没有发出心跳,那么本节点自动重启

node serverC.cyhd.com.cn #主节点名称,与uname -n显示必须一致

node serverD.cyhd.com.cn #备用节点名称

respawn hacluster /usr/lib64/heartbeat/ipfail #

apiauth ipfail gid=haclient uid=hacluster

(4)文件系统切换脚本:

#!/bin/bash

unset LC_ALL; export LC_ALL

unset LANGUAGE; export LANGUAGE

prefix=/usr

exec_prefix=/usr

. /etc/ha.d/shellfuncs

case "$1" in

'start')

#/sbin/drbdadm -- --do-what-I-say primary all

/sbin/drbdadm primary all

#drbdsetup /dev/drbd1 primary -o

/bin/mount /dev/drbd0 /data/mysql

;;

'pre-start')

;;

'post-start')

;;

'stop')

/bin/umount /data/mysql

/sbin/drbdadm secondary all

;;

'pre-stop')

;;

'post-stop')

;;

*)

echo "Usage: $0 { start | pre-start | post-start | stop | pre-stop | post-stop }"

;;

esac

exit 0

(5)配置haresource,添加如下一行:

serverC.cyhd.com.cn IPaddr::192.168.20.70/24/eth0:1 mysqld_umount mysqld

(6)将切换文件系统脚本和MySQL启动脚本放在/etc/ha.d/resource.d 目录下面:

chmod a+x /etc/ha.d/resource.d/mysqld_umount

cp /etc/init.d/mysqld /etc/ha.d/resource.d/

(7)修改备机相关配置:

Drbd备机和Drbd主机配置基本相同。修改备机上/etc/ha.d/ha.cf 中的ucast eth1为对方的IP也就是serverD主机的ETH1的IP 改为ucast eth1 10.0.0.64

3.2 Heartbeat测试

两边同时启动heartbeat 观察日志

serverC上 HA的日志:

[root@serverC ~]# tail -f /var/log/ha-log

heartbeat[15976]: 2010/08/10_20:45:04 info: Version 2 support: false

heartbeat[15976]: 2010/08/10_20:45:04 WARN: Logging daemon is disabled --enabling logging daemon is recommended

heartbeat[15976]: 2010/08/10_20:45:04 info: **************************

heartbeat[15976]: 2010/08/10_20:45:04 info: Configuration validated. Starting heartbeat 2.1.3

heartbeat[15977]: 2010/08/10_20:45:04 info: heartbeat: version 2.1.3

heartbeat[15977]: 2010/08/10_20:45:04 info: Heartbeat generation: 1281440434

heartbeat[15977]: 2010/08/10_20:45:04 info: glib: ucast: write socket priority set to IPTOS_LOWDELAY on eth1

heartbeat[15977]: 2010/08/10_20:45:04 info: glib: ucast: bound send socket to device: eth1

heartbeat[15977]: 2010/08/10_20:45:04 info: glib: ucast: bound receive socket to device: eth1

heartbeat[15977]: 2010/08/10_20:45:04 info: glib: ucast: started on port 694 interface eth1 to 10.0.0.64

heartbeat[15977]: 2010/08/10_20:45:04 info: G_main_add_TriggerHandler: Added signal manual handler

heartbeat[15977]: 2010/08/10_20:45:04 info: G_main_add_TriggerHandler: Added signal manual handler

heartbeat[15977]: 2010/08/10_20:45:04 notice: Using watchdog device: /dev/watchdog

heartbeat[15977]: 2010/08/10_20:45:04 info: G_main_add_SignalHandler: Added signal handler for signal 17

heartbeat[15977]: 2010/08/10_20:45:04 info: Local status now set to: 'up'

heartbeat[15977]: 2010/08/10_20:45:06 info: Link serverd.cyhd.com.cn:eth1 up.

heartbeat[15977]: 2010/08/10_20:45:06 info: Status update for node serverd.cyhd.com.cn: status up

harc[15984]: 2010/08/10_20:45:06 info: Running /etc/ha.d/rc.d/status status

heartbeat[15977]: 2010/08/10_20:45:06 info: Comm_now_up(): updating status to active

heartbeat[15977]: 2010/08/10_20:45:06 info: Local status now set to: 'active'

heartbeat[15977]: 2010/08/10_20:45:06 info: Starting child client "/usr/lib64/heartbeat/ipfail" (498,496)

heartbeat[16001]: 2010/08/10_20:45:06 info: Starting "/usr/lib64/heartbeat/ipfail" as uid 498 gid 496 (pid 16001)

heartbeat[15977]: 2010/08/10_20:45:06 info: Status update for node serverd.cyhd.com.cn: status active

harc[16002]: 2010/08/10_20:45:06 info: Running /etc/ha.d/rc.d/status status

ipfail[16001]: 2010/08/10_20:45:14 info: Ping node count is balanced.

heartbeat[15977]: 2010/08/10_20:45:17 info: local resource transition completed.

heartbeat[15977]: 2010/08/10_20:45:17 info: Initial resource acquisition complete (T_RESOURCES(us))

IPaddr[16056]: 2010/08/10_20:45:17 INFO: Resource is stopped

heartbeat[16020]: 2010/08/10_20:45:17 info: Local Resource acquisition completed.

heartbeat[15977]: 2010/08/10_20:45:17 info: remote resource transition completed.

harc[16107]: 2010/08/10_20:45:17 info: Running /etc/ha.d/rc.d/ip-request-resp ip-request-resp

ip-request-resp[16107]: 2010/08/10_20:45:18 received ip-request-resp IPaddr::192.168.20.70/24/eth0:1 OK yes

ResourceManager[16128]: 2010/08/10_20:45:18 info: Acquiring resource group: serverc.cyhd.com.cn IPaddr::192.168.20.70/24/eth0:1 mysqld_umount mysqld

IPaddr[16155]: 2010/08/10_20:45:18 INFO: Resource is stopped

ResourceManager[16128]: 2010/08/10_20:45:18 info: Running /etc/ha.d/resource.d/IPaddr 192.168.20.70/24/eth0:1 start

IPaddr[16253]: 2010/08/10_20:45:18 INFO: Using calculated netmask for 192.168.20.70: 255.255.255.0

IPaddr[16253]: 2010/08/10_20:45:18 INFO: eval ifconfig eth0:0 192.168.20.70 netmask 255.255.255.0 broadcast 192.168.20.255

IPaddr[16224]: 2010/08/10_20:45:18 INFO: Success

ResourceManager[16128]: 2010/08/10_20:45:19 info: Running /etc/ha.d/resource.d/mysqld_umount start

ResourceManager[16128]: 2010/08/10_20:45:19 info: Running /etc/ha.d/resource.d/mysqld start

serverC网络状态

[root@serverC mnt]# ifconfig eth0:0

eth0:0 Link encap:Ethernet HWaddr 00:0C:29:D4:B7:0D

inet addr:192.168.20.70 Bcast:192.168.20.255 Mask:255.255.255.0

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

serverC文件系统状态

[root@serverC ~]# mount

/dev/sda3 on / type ext3 (rw)

proc on /proc type proc (rw)

sysfs on /sys type sysfs (rw)

devpts on /dev/pts type devpts (rw,gid=5,mode=620)

/dev/sda1 on /boot type ext3 (rw)

tmpfs on /dev/shm type tmpfs (rw)

none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)

sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)

/dev/drbd0 on /data/mysql type ext3 (rw)

serverD上 HA的日志:

[root@serverD ~]# tail -f /var/log/ha-log

heartbeat[4835]: 2010/08/10_20:45:15 info: Version 2 support: false

heartbeat[4835]: 2010/08/10_20:45:15 WARN: Logging daemon is disabled --enabling logging daemon is recommended

heartbeat[4835]: 2010/08/10_20:45:15 info: **************************

heartbeat[4835]: 2010/08/10_20:45:15 info: Configuration validated. Starting heartbeat 2.1.3

heartbeat[4836]: 2010/08/10_20:45:15 info: heartbeat: version 2.1.3

heartbeat[4836]: 2010/08/10_20:45:15 info: Heartbeat generation: 1281440507

heartbeat[4836]: 2010/08/10_20:45:15 info: glib: ucast: write socket priority set to IPTOS_LOWDELAY on eth1

heartbeat[4836]: 2010/08/10_20:45:15 info: glib: ucast: bound send socket to device: eth1

heartbeat[4836]: 2010/08/10_20:45:15 info: glib: ucast: bound receive socket to device: eth1

heartbeat[4836]: 2010/08/10_20:45:15 info: glib: ucast: started on port 694 interface eth1 to 10.0.0.63

heartbeat[4836]: 2010/08/10_20:45:15 info: G_main_add_TriggerHandler: Added signal manual handler

heartbeat[4836]: 2010/08/10_20:45:15 info: G_main_add_TriggerHandler: Added signal manual handler

heartbeat[4836]: 2010/08/10_20:45:15 notice: Using watchdog device: /dev/watchdog

heartbeat[4836]: 2010/08/10_20:45:15 info: G_main_add_SignalHandler: Added signal handler for signal 17

heartbeat[4836]: 2010/08/10_20:45:15 info: Local status now set to: 'up'

heartbeat[4836]: 2010/08/10_20:45:16 info: Link serverc.cyhd.com.cn:eth1 up.

heartbeat[4836]: 2010/08/10_20:45:16 info: Status update for node serverc.cyhd.com.cn: status up

harc[4843]: 2010/08/10_20:45:16 info: Running /etc/ha.d/rc.d/status status

heartbeat[4836]: 2010/08/10_20:45:16 info: Comm_now_up(): updating status to active

heartbeat[4836]: 2010/08/10_20:45:16 info: Local status now set to: 'active'

heartbeat[4836]: 2010/08/10_20:45:16 info: Starting child client "/usr/lib64/heartbeat/ipfail" (498,496)

heartbeat[4860]: 2010/08/10_20:45:16 info: Starting "/usr/lib64/heartbeat/ipfail" as uid 498 gid 496 (pid 4860)

heartbeat[4836]: 2010/08/10_20:45:17 info: Status update for node serverc.cyhd.com.cn: status active

harc[4863]: 2010/08/10_20:45:17 info: Running /etc/ha.d/rc.d/status status

ipfail[4860]: 2010/08/10_20:45:21 info: Status update: Node serverc.cyhd.com.cn now has status active

ipfail[4860]: 2010/08/10_20:45:23 info: Asking other side for ping node count.

ipfail[4860]: 2010/08/10_20:45:25 info: No giveup timer to abort.

heartbeat[4836]: 2010/08/10_20:45:27 info: remote resource transition completed.

heartbeat[4836]: 2010/08/10_20:45:27 info: remote resource transition completed.

heartbeat[4836]: 2010/08/10_20:45:27 info: Initial resource acquisition complete (T_RESOURCES(us))

heartbeat[4881]: 2010/08/10_20:45:28 info: No local resources [/usr/share/heartbeat/ResourceManager listkeys serverd.cyhd.com.cn] to acquire.

serverD网络状态

[root@serverD ~]# ip addr

2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000

link/ether 00:0c:29:f9:15:a0 brd ff:ff:ff:ff:ff:ff

inet 192.168.20.64/24 brd 192.168.20.255 scope global eth0

inet6 fe80::20c:29ff:fef9:15a0/64 scope link

valid_lft forever preferred_lft forever

serverD文件系统状态

[root@serverD ~]# mount

/dev/sda3 on / type ext3 (rw)

proc on /proc type proc (rw)

sysfs on /sys type sysfs (rw)

devpts on /dev/pts type devpts (rw,gid=5,mode=620)

/dev/sda1 on /boot type ext3 (rw)

tmpfs on /dev/shm type tmpfs (rw)

none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)

sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)

Heartbeat+drbd+mysql切换测试

serverC上停止HA服务

[root@serverC ~]# service heartbeat stop

serverC上 HA的日志:

[root@serverC ~]# tail -f /var/log/ha-log

heartbeat[15977]: 2010/08/10_20:49:22 info: Heartbeat shutdown in progress. (15977)

heartbeat[16711]: 2010/08/10_20:49:22 info: Giving up all HA resources.

ResourceManager[16724]: 2010/08/10_20:49:22 info: Releasing resource group: serverc.cyhd.com.cn IPaddr::192.168.20.70/24/eth0:1 mysqld_umount mysqld

ResourceManager[16724]: 2010/08/10_20:49:22 info: Running /etc/ha.d/resource.d/mysqld stop

ResourceManager[16724]: 2010/08/10_20:49:23 info: Running /etc/ha.d/resource.d/mysqld_umount stop

ResourceManager[16724]: 2010/08/10_20:49:23 info: Running /etc/ha.d/resource.d/IPaddr 192.168.20.70/24/eth0:1 stop

IPaddr[16840]: 2010/08/10_20:49:23 INFO: ifconfig eth0:0 down

IPaddr[16811]: 2010/08/10_20:49:23 INFO: Success

heartbeat[16711]: 2010/08/10_20:49:23 info: All HA resources relinquished.

heartbeat[15977]: 2010/08/10_20:49:24 WARN: 1 lost packet(s) for [serverd.cyhd.com.cn] [144:146]

heartbeat[15977]: 2010/08/10_20:49:24 info: No pkts missing from serverd.cyhd.com.cn!

heartbeat[15977]: 2010/08/10_20:49:24 info: killing /usr/lib64/heartbeat/ipfail process group 16001 with signal 15

heartbeat[15977]: 2010/08/10_20:49:26 info: killing HBFIFO process 15980 with signal 15

heartbeat[15977]: 2010/08/10_20:49:26 info: killing HBWRITE process 15981 with signal 15

heartbeat[15977]: 2010/08/10_20:49:26 info: killing HBREAD process 15982 with signal 15

heartbeat[15977]: 2010/08/10_20:49:26 info: Core process 15981 exited. 3 remaining

heartbeat[15977]: 2010/08/10_20:49:26 info: Core process 15982 exited. 2 remaining

heartbeat[15977]: 2010/08/10_20:49:26 info: Core process 15980 exited. 1 remaining

heartbeat[15977]: 2010/08/10_20:49:26 info: serverc.cyhd.com.cn Heartbeat shutdown complete.

serverC网络状态

[root@serverD ~]# ip addr

[root@serverC mnt]# ip addr

2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000

link/ether 00:0c:29:d4:b7:0d brd ff:ff:ff:ff:ff:ff

inet 192.168.20.63/24 brd 192.168.20.255 scope global eth0

inet6 fe80::20c:29ff:fed4:b70d/64 scope link

valid_lft forever preferred_lft forever

serverC文件系统状态

[root@serverC mnt]# mount

/dev/sda3 on / type ext3 (rw)

proc on /proc type proc (rw)

sysfs on /sys type sysfs (rw)

devpts on /dev/pts type devpts (rw,gid=5,mode=620)

/dev/sda1 on /boot type ext3 (rw)

tmpfs on /dev/shm type tmpfs (rw)

none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)

sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)

serverD上 HA的日志:

[root@serverD ~]# tail -f /var/log/ha-log

heartbeat[4836]: 2010/08/10_20:49:34 info: Received shutdown notice from 'serverc.cyhd.com.cn'.

heartbeat[4836]: 2010/08/10_20:49:34 info: Resources being acquired from serverc.cyhd.com.cn.

heartbeat[4901]: 2010/08/10_20:49:34 info: acquire local HA resources (standby).

heartbeat[4902]: 2010/08/10_20:49:34 info: No local resources [/usr/share/heartbeat/ResourceManager listkeys serverd.cyhd.com.cn] to acquire.

heartbeat[4901]: 2010/08/10_20:49:34 info: local HA resource acquisition completed (standby).

heartbeat[4836]: 2010/08/10_20:49:34 info: Standby resource acquisition done [all].

harc[4927]: 2010/08/10_20:49:34 info: Running /etc/ha.d/rc.d/status status

mach_down[4943]: 2010/08/10_20:49:34 info: Taking over resource group IPaddr::192.168.20.70/24/eth0:1

ResourceManager[4969]: 2010/08/10_20:49:34 info: Acquiring resource group: serverc.cyhd.com.cn IPaddr::192.168.20.70/24/eth0:1 mysqld_umount mysqld

IPaddr[4996]: 2010/08/10_20:49:34 INFO: Resource is stopped

ResourceManager[4969]: 2010/08/10_20:49:34 info: Running /etc/ha.d/resource.d/IPaddr 192.168.20.70/24/eth0:1 start

IPaddr[5094]: 2010/08/10_20:49:35 INFO: Using calculated netmask for 192.168.20.70: 255.255.255.0

IPaddr[5094]: 2010/08/10_20:49:35 INFO: eval ifconfig eth0:0 192.168.20.70 netmask 255.255.255.0 broadcast 192.168.20.255

IPaddr[5065]: 2010/08/10_20:49:35 INFO: Success

ResourceManager[4969]: 2010/08/10_20:49:35 info: Running /etc/ha.d/resource.d/mysqld_umount start

ResourceManager[4969]: 2010/08/10_20:49:36 info: Running /etc/init.d/mysqld start

mach_down[4943]: 2010/08/10_20:49:36 info: /usr/share/heartbeat/mach_down: nice_failback: foreign resources acquired

mach_down[4943]: 2010/08/10_20:49:37 info: mach_down takeover complete for node serverc.cyhd.com.cn.

heartbeat[4836]: 2010/08/10_20:49:37 info: mach_down takeover complete.

heartbeat[4836]: 2010/08/10_20:49:46 WARN: node serverc.cyhd.com.cn: is dead

heartbeat[4836]: 2010/08/10_20:49:46 info: Dead node serverc.cyhd.com.cn gave up resources.

ipfail[4860]: 2010/08/10_20:49:46 info: Status update: Node serverc.cyhd.com.cn now has status dead

heartbeat[4836]: 2010/08/10_20:49:46 info: Link serverc.cyhd.com.cn:eth1 dead.

ipfail[4860]: 2010/08/10_20:49:47 info: NS: We are dead. :<

ipfail[4860]: 2010/08/10_20:49:47 info: Link Status update: Link serverc.cyhd.com.cn/eth1 now has status dead

ipfail[4860]: 2010/08/10_20:49:48 info: We are dead. :&lt;

ipfail[4860]: 2010/08/10_20:49:48 info: Asking other side for ping node count.

serverD网络状态

[root@serverD ~]# ip addr

2: eth0: &lt;BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000

link/ether 00:0c:29:f9:15:a0 brd ff:ff:ff:ff:ff:ff

inet 192.168.20.64/24 brd 192.168.20.255 scope global eth0

inet 192.168.20.70/24 brd 192.168.20.255 scope global secondary eth0:0

inet6 fe80::20c:29ff:fef9:15a0/64 scope link

valid_lft forever preferred_lft forever

serverD文件系统状态

[root@serverD ~]# mount

/dev/sda3 on / type ext3 (rw)

proc on /proc type proc (rw)

sysfs on /sys type sysfs (rw)

devpts on /dev/pts type devpts (rw,gid=5,mode=620)

/dev/sda1 on /boot type ext3 (rw)

tmpfs on /dev/shm type tmpfs (rw)

none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)

sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)

/dev/drbd0 on /data/mysql type ext3 (rw)

服务启动的顺序,drbd让系统自动加载,heartbeat 放在/etc/rc.local里面,不然会出错,因为heartbeat会在drbd前面启动,你可以调整他们两的启动顺序。MYSQLD不要开机自动加载启动

©著作权归作者所有:来自51CTO博客作者matthew0701的原创作品,如需转载,请注明出处,否则将追究法律责任

MySQL数据库休闲负载均衡


点击查看更多内容
TA 点赞

若觉得本文不错,就分享一下吧!

评论

作者其他优质文章

正在加载中
  • 推荐
  • 评论
  • 收藏
  • 共同学习,写下你的评论
感谢您的支持,我会继续努力的~
扫码打赏,你说多少就多少
赞赏金额会直接到老师账户
支付方式
打开微信扫一扫,即可进行扫码打赏哦
今天注册有机会得

100积分直接送

付费专栏免费学

大额优惠券免费领

立即参与 放弃机会
意见反馈 帮助中心 APP下载
官方微信

举报

0/150
提交
取消