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拓撲圖
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設備
[[email protected] ~]# 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 [[email protected] ~]# 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
[[email protected] ~]# /etc/init.d/drbd start Starting DRBD resources: [ d(r0) s(r0) n(r0) ]. [[email protected] ~]# /etc/init.d/drbd start Starting DRBD resources: [ d(r0) s(r0) n(r0) ]. |
(5)兩臺機器Drbd狀態
[[email protected] ~]# cat /proc/drbd version: 8.2.6 (api:88/proto:86-88) GIT-hash: 3e69822d3bb4920a8c1bfdf7d647169eba7d2eb4 build by [email protected], 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 [[email protected] ~]# cat /proc/drbd version: 8.2.6 (api:88/proto:86-88) GIT-hash: 3e69822d3bb4920a8c1bfdf7d647169eba7d2eb4 build by [email protected], 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上執行: [[email protected] ~]# drbdsetup /dev/drbd0 primary –o 主備機狀態分別是"主/備",主機磁盤狀態是"實時",備機狀態是"不一致". 在第3行,可以看到數據正在同步中,即主機正在將磁盤上的數據,傳遞到備機上.現在的進度是[>...................] sync'ed: 0.4% (1040316/1040316)K 稍等一會,在數據同步完後,再查看一下ha1的DRBD狀態: 磁盤狀態都是"實時",表示數據同步完成了. 你現在可以把主機上的DRBD設備掛載到一個目錄上進行使用.備機的DRBD設備無法被掛載,因爲它是用來接收主機數據的,由DRBD負責操作. 在serverC執行 [[email protected] ~]# mkfs.ext3 /dev/drbd0 //網上這裏有很多不同的版本,具體drbd深入我還沒有研究,我現在安裝的版本是隻要在第一臺上面格式化文件系統,他會自動傳過去。如果你在serverD上格式化,他會提示出錯,而且格式化要在上面相應工作做完以後纔可以到這一步。 |
3.2切換測試
寫入測試數據:
[[email protected] ~]# mount /dev/drbd0 /mnt [[email protected] ~]# touch /mnt/matthew [roo[email protected] ~]# ls matthew lost+found |
DRBD的主備機切換有時,你需要將DRBD的主備機互換一下.可以執行下面的操作:
在主機上,先要卸載掉DRBD設備
將主機降級爲"備機"
[[email protected] ~]# umount /mnt [[email protected] ~]# drbdadm secondary r0 [[email protected] ~]#cat /proc/drbd version: 8.2.6 (api:88/proto:86-88) GIT-hash: 3e69822d3bb4920a8c1bfdf7d647169eba7d2eb4 build by [email protected], 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上,將它升級爲"主機".
[[email protected] ~]#drbdadm primary r0 [[email protected] ~]# cat /proc/drbdversion: 8.2.6 (api:88/proto:86-88) GIT-hash: 3e69822d3bb4920a8c1bfdf7d647169eba7d2eb4 build by [email protected], 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成爲主機了。 |
查看備機目錄下內容
[[email protected] ~]# mount /dev/drbd0 /mnt [[email protected] 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
兩邊同時啓動heartbeat 觀察日誌
serverC上 HA的日誌:
[[email protected] ~]# 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網絡狀態
[[email protected] 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文件系統狀態
[[email protected] ~]# 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的日誌:
[[email protected] ~]# 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網絡狀態
[[email protected] ~]# 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文件系統狀態
[[email protected] ~]# 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) |
serverC上停止HA服務
[[email protected] ~]# service heartbeat stop |
serverC上 HA的日誌:
[[email protected] ~]# 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網絡狀態
[[email protected] ~]# ip addr [[email protected] 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文件系統狀態
[[email protected] 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的日誌:
[[email protected] ~]# 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. :< ipfail[4860]: 2010/08/10_20:49:48 info: Asking other side for ping node count. |
serverD網絡狀態
[[email protected] ~]# 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 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文件系統狀態
[[email protected] ~]# 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不要開機自動加載啓動