Chinaunix
标题: [MySQL集群架构] Heartbeat + Drbd +Mysql 构建高可用的MYSQL数据库服务 [打印本页]
作者: so_brave 时间: 2011-12-10 22:59
标题: [MySQL集群架构] Heartbeat + Drbd +Mysql 构建高可用的MYSQL数据库服务
[MySQL集群架构] Heartbeat + Drbd +Mysql 构建高可用的MYSQL数据库服务
1,什么是DRBD
是由内核模块和相关脚本而构成,用以构建高可用性的集群。其实现方式是通过网络来镜像整个设备。您可以把它看作是一种网络RAID1
Drbd 负责接收数据,把数据写到本地磁盘,然后发送给另一个主机。另一个主机再将数据存到自己的磁盘中。其他所需的组件有集群成员服务,如TurboHA 或 心跳连接,以及一些能在块设备上运行的应用程序
环境
CentOS 5.2
Eth0:192.168.0.251
Eth1:192.168.254.4
CentOS 5.2
Eth0:192.168.0.252
Eth1:192.168.254.5
2. /etc/hosts 文件中新增加的内容,两边一样
ha1:192.168.254.4
ha2:192.168.254.5
OS:CentOS 5.2
软件:drbd8.2 kmod-8.2
安装drbd 及drbd内核模块-
- #
- 01.yum -y install drbd82 kmod-drbd82
- 复制代码3.修改配置文件
- #mv /etc/drbd.conf /etc/drbd.conf.bak 备份原配置文件
- #vim /etc/drbd.conf
- 01. global { usage-count yes; }
-
- 02.
-
- 03. common { syncer { rate 10M; } } //如果是100M网络,就写100
-
- 04.
-
- 05. resource r0 {
-
- 06.
-
- 07. protocol C;
-
- 08. net {
-
- 09.
-
- 10. cram-hmac-alg sha1;
-
- 11. shared-secret "FooFunFactory";
-
- 12. }
-
- 13.
-
- 14. on ha1 {
-
- 15.
-
- 16. device /dev/drbd0;
-
- 17. disk /dev/sdb1;
-
- 18.
-
- 19. address 192.168.254.4:7898;
-
- 20. meta-disk internal;
-
- 21. }
-
- 22. on ha2 {
-
- 23. device /dev/drbd0;
-
- 24. disk /dev/sdb1;
-
- 25. address 192.168.254.5:7898;
-
- 26. meta-disk internal;
-
- 27. }
-
- 28. }
-
- 29.
- 复制
复制代码 代码我的是很简单的,为了测试,还需要大家根据自己的需要自己修改~
好了两台机器都写完配置文件后,两边的drbd.conf 配置一模一样
在ha1和ha2上分别输入命令
#
01.drbdadm create-md r0
复制代码“r0"是我们在drbd.conf里定义
弹出的信息,敲回车,如果drbd.conf配置好的话,有的信息是不会弹出的。- HA1上
-
- [root@ha1 etc]#
- 01.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.
-
- HA2 上
-
- [root@ha2 etc]#
- 01.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.
-
复制代码 现在我们可以启动DRBD了,分别在两台主机上执行:- [root@ha1 etc]# /etc/init.d/drbd start
- Starting DRBD resources: [ d(r0) s(r0) n(r0) ].
- ..........
- ***************************************************************
- DRBD's startup script waits for the peer node(s) to appear.
- - In case this node was already a degraded cluster before the
- reboot the timeout is 0 seconds. [degr-wfc-timeout]
- - If the peer was available before the reboot the timeout will
- expire after 0 seconds. [wfc-timeout]
- (These values are for resource 'r0'; 0 sec -> wait forever)
- To abort waiting enter 'yes' [ 23]: //在这个时候你在HA2 上启动服务,就会马上成功启动服务,因为他在等待另一个节点
- [root@ha2 etc]# /etc/init.d/drbd start
- Starting DRBD resources: [ d(r0) s(r0) n(r0) ].
-
- [root@ha1 etc]# 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:32
- 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:8385604
-
-
- [root@ha2 etc]# 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:32
- 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:8385604
复制代码 "/proc/drbd"中显示了drbd当前的状态.第一行的st表示两台主机的状态,都是"备机"状态.
ds是磁盘状态,都是"不一致"状态.
这是由于,DRBD无法判断哪一方为主机,以哪一方的磁盘数据作为标准数据.所以,我们需要初始化
一个主机.在drbd1上执行:- [root@drbd1 local]#
- 01.drbdsetup /dev/drbd0 primary -o
复制代码 复制代码主备机状态分别是"主/备",主机磁盘状态是"实时",备机状态是"不一致".
在第3行,可以看到数据正在同步中,即主机正在将磁盘上的数据,传递到备机上.现在的进度是[>...................] sync'ed: 0.4% (1040316/1040316)K
稍等一会,在数据同步完后,再查看一下ha1的DRBD状态:
磁盘状态都是"实时",表示数据同步完成了.
你现在可以把主机上的DRBD设备挂载到一个目录上进行使用.备机的DRBD设备无法被挂载,因为它是
用来接收主机数据的,由DRBD负责操作.
在drbd1执行
root@ha1:~#复制代码//网上这里有很多不同的版本,具体drbd深入我还没有研究,我现在安装的版本是只要在第一台上面格式化文件系统,他会自动传过去。如果你在ha2上格式化,他会提示出错,而且格式化要在上面相应工作做完以后才可以到这一步。- root@ha1:~#
- 01.mount /dev/drbd0 /mnt
- 复制代码root@ha1:~#
- 01. cd /mnt
- 复制代码root@ha1:/mnt#
- 01. touch huzi
- 复制代码root@dha1:/mnt# ls
- huzi lost+found
复制代码 可以看到,在主机drbd1上产生的文件huzi,也完整的保存在备机drbd2的DRBD分区上.
这就是DRBD的网络RAID-1功能. 在主机上的任何操作,都会被同步到备机的相应磁盘分区上,达到数据备份的效果.
DRBD的主备机切换有时,你需要将DRBD的主备机互换一下.可以执行下面的操作:
在主机上,先要卸载掉DRBD设备
root@drbd1~#
01.umount /mnt
复制代码将主机降级为"备机"
root@ha1~#- 01.drbdadm secondary r0
- 复制代码[root@ha1 ~]#
复制代码- version: 8.2.6 (api:88/proto:86-88)
- GIT-hash: 3e69822d3bb4920a8c1bfdf7d647169eba7d2eb4 build by buildsvn@c5-i386-build, 2008-10-03 11:42:32
- 0: 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
- 现在,两台主机都是"备机".
复制代码 在备机drbd2上,将它升级为"主机".- [root@ha2 mnt]#
- 01.drbdadm primary r0
- 复制代码[root@ha2 etc]#
- 01.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:32
- 0: 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
- [root@ha2 etc]#
- 01.mount /dev/drbd0 /mnt
- 复制代码[root@ha2 etc]#
- 01.cd /mnt
- 复制代码[root@ha2 mnt]#
- 01.ls
- 复制代码huzi lost+found
- [root@ha2 mnt]#
- 01. ll
- 复制代码
复制代码 total 16
-rw-r--r-- 1 root root 0 Mar 19 11:02 huzi
drwx------ 2 root root 16384 Mar 19 11:01 lost+found
现在drbd2成为主机了。
DRBD相关切换命令
DRBD切换
drbdadm secondary r0 //把主机切换成备机
drbdadm primary r0 //把主机切换成主机
注意,在我测试的情况。DRBD只有主机可以读写,备机不能够挂载,也就是说不能够读。可能是我的drbd.conf文件配置方面的原因 ,我会继续找一些文章来读,这样对于数据库是可以满足的,如果想做WEB。可以有些台只是用来读取的,不过我们这里只讨论数据库
------------------------------------------------------------------
上面的DRBD已经成功配置完成,可以正常切换,现在我们让两台成为高可用,所谓高可用,就是双机热备,互备。这里我不解释太多,相应搞过HA的人都清楚,不清楚的上www.linux-ha.org 上面看看文档。
主机ha1和ha2上安装heartbeat- 01.yum ?y install heartbeat && yum ?y install heartbeat
- 复制代码
复制代码 //这里我也不清楚为什么要运行两次他才给我安装heartbeat ,嘿嘿,哪位知道告诉我为什么,我是每次都要晕两次才可以我安装
在主机ha1和ha2 上安装mysql mysql-server- 01.yum ?y install mysql mysql-server
- 复制代码
复制代码 以下只在ha1上进行操作
在ha1上启动mysql- 01.service mysqld start
- 复制代码
复制代码 //初始化数据库数据文件
再停止数据库- 01.service mysqld stop
- 复制代码
复制代码- 01.mount /dev/drbd0 /mnt
- 复制代码
复制代码- 01.cp /var/lib/mysql/* /mnt -ar
- 复制代码
复制代码 配置heartbeat
拷呗 cp /usr/share/doc/heartbeat-2.1.3/ 下面的 ha.cf,authkeys,haresources 到/etc/ha.d 目录下面- 01.cp /usr/share/doc/heartbeat-2.1.3/haresources /etc/ha.d
-
- 02.cp /usr/share/doc/heartbeat-2.1.3/ha.cf /etc/ha.d
-
- 03.cp /usr/share/doc/heartbeat-2.1.3/authkeys /etc/ha.d
- 复制代码
复制代码- 01.cd /etc/ha.d
-
- 02.
-
- 03.chmod 600 authkeys
- 复制代码
复制代码 authkeys文件中下面两行前面的#号去掉- vi authkeys
- 01.auth 1
-
- 02.1 crc
- 复制代码
复制代码 配置ha.cf 内容如下,我就不一一解释了,有英语注释,注意的地方我会加注释- 01.debugfile /var/log/ha-debug
-
- 02.logfile /var/log/ha-log
-
- 03.logfacility local0
-
- 04.keepalive 2
-
- 05.deadtime 10
-
- 06.warntime 5
- 07.initdead 120
-
- 08.ucast eth1 192.168.254.5 //这里是对方的ip 主要用于HA的相互检测 网络接口要注意了,我用的是专用接口,ha2主机改为192.168.254.4
- 09.auto_failback on
-
- 10.watchdog /dev/watchdog
-
- 11.node ha1
-
- 12.node ha2
-
- 13.ping 192.168.254.1
-
- 14.respawn hacluster /usr/lib/heartbeat/ipfail
-
- 15.apiauth ipfail gid=haclient uid=hacluster
复制代码 复制代码添加自动加载drbd 及持载文件系统的脚本,放在/etc/ha.d/resource.d 目录下面- vi mysqld_umount
- 01.#!/bin/sh
-
- 02.#
-
- 03.# High-Availability Pre-Startup/Shutdown Script
-
- 04.#
-
- 05.# Description: Runs on Startup or shutdown of heartbeat (not resource based).
-
- 06.# Also runs before start, after start or before stop,
-
- 07.# and after stop.
-
- 08.#
-
- 09.# Author: Matthew Soffen
-
- 10.#
-
- 11.# Support: linux-ha@lists.linux-ha.org
-
- 12.#
-
- 13.# License: GNU Lesser General Public License (LGPL)
-
- 14.#
-
- 15.# Copyright: (C) 2002 Matthew Soffen
-
- 16.#
-
- 17.#
-
- 18.unset LC_ALL; export LC_ALL
-
- 19.unset LANGUAGE; export LANGUAGE
-
- 20.
-
- 21.prefix=/usr
-
- 22.exec_prefix=/usr
-
- 23.. /etc/ha.d/shellfuncs
-
- 24.
-
- 25.case "$1" in
-
- 26.'start')
-
- 27.#/sbin/drbdadm -- --do-what-I-say primary all
-
- 28./sbin/drbdadm primary all
-
- 29.#drbdsetup /dev/drbd1 primary -o
-
- 30./bin/mount /dev/drbd0 /var/lib/mysql
-
- 31. ;;
-
- 32.'pre-start')
-
- 33. ;;
-
- 34.'post-start')
-
- 35. ;;
-
- 36.'stop')
-
- 37./bin/umount /var/lib/mysql
-
- 38./sbin/drbdadm secondary all
-
- 39.;;
-
- 40.'pre-stop')
-
- 41. ;;
-
- 42.'post-stop')
-
- 43. ;;
-
- 44.*)
-
- 45. echo "Usage: $0 { start | pre-start | post-start | stop | pre-stop | post-stop }"
-
- 46. ;;
-
- 47.
-
- 48.esac
-
- 49.exit 0
- 复制代码
复制代码 配置haresource
添加如下一行- 01.ha1 IPaddr::192.168.0.253/24/eth0:1 mysqld_umount mysqld
复制代码 复制代码工作完成,把/etc/ha.d目录全部覆盖到ha2上面去
- 01.scp -r /etc/ha.d 192.168.254.5:/etc
复制代码 复制代码提示输入对方root用户的密码,全部转输完以后,注意修改/etc/ha.d/ha.cf 中的ucast eth1 192.168.254.5 为对方的IP也就是HA1主机的ETH1的IP 改为ucast eth1 192.168.254.4
两边同时启动heartbeat 观察日志
HA1上 HA的日志-
- heartbeat[4039]: 2009/03/19_15:11:25 info: heartbeat: version 2.1.3
- heartbeat[4039]: 2009/03/19_15:11:25 info: Heartbeat generation: 1237438269
- heartbeat[4039]: 2009/03/19_15:11:25 info: glib: ucast: write socket priority set to IPTOS_LOWDELAY on eth1
- heartbeat[4039]: 2009/03/19_15:11:25 info: glib: ucast: bound send socket to device: eth1
- heartbeat[4039]: 2009/03/19_15:11:25 info: glib: ucast: bound receive socket to device: eth1
- heartbeat[4039]: 2009/03/19_15:11:25 info: glib: ucast: started on port 694 interface eth1 to 192.168.254.5
- heartbeat[4039]: 2009/03/19_15:11:25 info: glib: ping heartbeat started.
- heartbeat[4039]: 2009/03/19_15:11:25 info: G_main_add_TriggerHandler: Added signal manual handler
- heartbeat[4039]: 2009/03/19_15:11:25 info: G_main_add_TriggerHandler: Added signal manual handler
- heartbeat[4039]: 2009/03/19_15:11:25 notice: Using watchdog device: /dev/watchdog
- heartbeat[4039]: 2009/03/19_15:11:25 info: G_main_add_SignalHandler: Added signal handler for signal 17
- heartbeat[4039]: 2009/03/19_15:11:25 info: Local status now set to: 'up'
- heartbeat[4039]: 2009/03/19_15:11:26 info: Link ha2:eth1 up.
- heartbeat[4039]: 2009/03/19_15:11:26 info: Status update for node ha2: status active
- heartbeat[4039]: 2009/03/19_15:11:26 info: Link 192.168.254.1:192.168.254.1 up.
- heartbeat[4039]: 2009/03/19_15:11:26 info: Status update for node 192.168.254.1: status ping
- harc[4048]: 2009/03/19_15:11:26 info: Running /etc/ha.d/rc.d/status status
- heartbeat[4039]: 2009/03/19_15:11:27 info: Comm_now_up(): updating status to active
- heartbeat[4039]: 2009/03/19_15:11:27 info: Local status now set to: 'active'
- heartbeat[4039]: 2009/03/19_15:11:27 info: Starting child client "/usr/lib/heartbeat/ipfail" (498,496)
- heartbeat[4065]: 2009/03/19_15:11:27 info: Starting "/usr/lib/heartbeat/ipfail" as uid 498 gid 496 (pid 4065)
- heartbeat[4039]: 2009/03/19_15:11:27 info: remote resource transition completed.
- heartbeat[4039]: 2009/03/19_15:11:27 info: remote resource transition completed.
- heartbeat[4039]: 2009/03/19_15:11:27 info: Local Resource acquisition completed. (none)
- heartbeat[4039]: 2009/03/19_15:11:28 info: ha2 wants to go standby [foreign]
- heartbeat[4039]: 2009/03/19_15:11:30 info: standby: acquire [foreign] resources from ha2
- heartbeat[4068]: 2009/03/19_15:11:30 info: acquire local HA resources (standby).
- ResourceManager[4081]: 2009/03/19_15:11:30 info: Acquiring resource group: ha1 IPaddr::192.168.0.253/24/eth0:1 mysqld_umount mysqld
- IPaddr[4108]: 2009/03/19_15:11:31 INFO: Resource is stopped
- ResourceManager[4081]: 2009/03/19_15:11:31 info: Running /etc/ha.d/resource.d/IPaddr 192.168.0.253/24/eth0:1 start
- IPaddr[4206]: 2009/03/19_15:11:31 INFO: Using calculated netmask for 192.168.0.253: 255.255.255.0
- IPaddr[4206]: 2009/03/19_15:11:32 INFO: eval ifconfig eth0:0 192.168.0.253 netmask 255.255.255.0 broadcast 192.168.0.255
- IPaddr[4177]: 2009/03/19_15:11:32 INFO: Success
- ResourceManager[4081]: 2009/03/19_15:11:32 info: Running /etc/ha.d/resource.d/mysqld_umount start
- ResourceManager[4081]: 2009/03/19_15:11:33 info: Running /etc/ha.d/resource.d/mysqld start
- ipfail[4065]: 2009/03/19_15:11:34 info: Ping node count is balanced.
- heartbeat[4068]: 2009/03/19_15:11:35 info: local HA resource acquisition completed (standby).
- heartbeat[4039]: 2009/03/19_15:11:35 info: Standby resource acquisition done [foreign].
- heartbeat[4039]: 2009/03/19_15:11:35 info: Initial resource acquisition complete (auto_failback)
- heartbeat[4039]: 2009/03/19_15:11:35 info: remote resource transition completed.
-
复制代码 通过以上观察,资源全部加载成功,我们来验证一下
网络加载- eth0:0 Link encap:Ethernet HWaddr 00:0C:29:39:A8:2B
- inet addr:192.168.0.253 Bcast:192.168.0.255 Mask:255.255.255.0
- UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
- Interrupt:169 Base address:0x2000
复制代码 文件系统加载code]/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/sda5 on /data type ext3 (rw)
/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)
/dev/drbd0 on /var/lib/mysql type ext3 (rw)
[root@ha1 resource.d][/code]-
- version: 8.2.6 (api:88/proto:86-88)
- GIT-hash: 3e69822d3bb4920a8c1bfdf7d647169eba7d2eb4 build by buildsvn@c5-i386-build, 2008-10-03 11:42:32
- 0: cs:Connectedst:Primary/Secondaryds:UpToDate/UpToDate C r---
- ns:512 nr:1008 dw:1520 dr:5950 al:9 bm:8 lo:0 pe:0 ua:0 ap:0 oos:0
复制代码 DRBD是在主机状态 ,MYSQL我就不贴出来,验证MYSQL就没有必要了,大家自己去验证吧,我已经验证过了,其实大家都知道,文件系统都过来了,还验证个啥子
资源的状态,HA处在备机状态- heartbeat[4412]: 2009/03/19_13:30:43 info: foreign HA resource release completed (standby).
- heartbeat[3795]: 2009/03/19_13:30:43 info: Local standby process completed [foreign].
- ipfail[3820]: 2009/03/19_13:30:44 info: No giveup timer to abort.
- heartbeat[3795]: 2009/03/19_13:30:45 WARN: 1 lost packet(s) for [ha1] [16:18]
- heartbeat[3795]: 2009/03/19_13:30:45 info: remote resource transition completed.
- heartbeat[3795]: 2009/03/19_13:30:45 info: No pkts missing from ha1!
- heartbeat[3795]: 2009/03/19_13:30:45 info: Other node completed standby takeover of foreign resources.
- [root@ha2 ha.d]#
复制代码 [root@ha2 ha.d]#- version: 8.2.6 (api:88/proto:86-88)
- GIT-hash: 3e69822d3bb4920a8c1bfdf7d647169eba7d2eb4 build by buildsvn@c5-i386-build, 2008-10-03 11:42:32
- 0: cs:Connected st:Secondary/Primary ds:UpToDate/UpToDate C r---
- ns:392 nr:832 dw:1224 dr:2989 al:9 bm:8 lo:0 pe:0 ua:0 ap:0 oos:0
复制代码 切换测试
HA1上停止HA服务- [root@ha1 resource.d]#
- 01.service heartbeat stop
- 复制代码
复制代码 Stopping High-Availability services:
[ OK ]
[root@ha1 resource.d]#
在HA2上观察- [root@ha2 ha.d]# tail /var/log/ha-log -f
- heartbeat[3795]: 2009/03/19_13:55:21 info: Standby resource acquisition done [foreign].
- harc[4636]: 2009/03/19_13:55:21 info: Running /etc/ha.d/rc.d/status status
- mach_down[4652]: 2009/03/19_13:55:21 info: Taking over resource group IPaddr::192.168.0.253/24/eth0:1
- ResourceManager[4678]: 2009/03/19_13:55:21 info: Acquiring resource group: ha1 IPaddr::192.168.0.253/24/eth0:1 mysqld_umount mysqld
- IPaddr[4705]: 2009/03/19_13:55:22 INFO: Resource is stopped
- ResourceManager[4678]: 2009/03/19_13:55:22 info: Running /etc/ha.d/resource.d/IPaddr 192.168.0.253/24/eth0:1 start
- IPaddr[4803]: 2009/03/19_13:55:22 INFO: Using calculated netmask for 192.168.0.253: 255.255.255.0
- IPaddr[4803]: 2009/03/19_13:55:22 INFO: eval ifconfig eth0:0 192.168.0.253 netmask 255.255.255.0 broadcast 192.168.0.255
- IPaddr[4774]: 2009/03/19_13:55:23 INFO: Success
- ResourceManager[4678]: 2009/03/19_13:55:23 info: Running /etc/ha.d/resource.d/mysqld_umount start
- ResourceManager[4678]: 2009/03/19_13:55:23 info: Running /etc/ha.d/resource.d/mysqld start
- mach_down[4652]: 2009/03/19_13:55:25 info: /usr/share/heartbeat/mach_down: nice_failback: foreign resources acquired
- mach_down[4652]: 2009/03/19_13:55:25 info: mach_down takeover complete for node ha1.
- heartbeat[3795]: 2009/03/19_13:55:25 info: mach_down takeover complete.
复制代码 验证不贴出来了,通过上面已经正常切换了,在10秒内
服务启动的顺序,drbd让系统自动加载,heartbeat 放在/etc/rc.local里面,不然会出错,为什么自己去想,因为heartbeat 在drbd前面启动,你可以调整他们两的启动顺序。MYSQLD不要开机自动加载启动,这里我把注意的地方写一下,自己快半年没弄HA啦。今天做起来有点问题,HA通信的IP是相互对方的IP地址,fence ip 一定要存在,因为我是虚拟机测试的,开始没注意,花了点时间来查找问题
这个对比AB复制,备机不可以用来读,但保证了高可用性。DRBD在生产上已经有人使用,如果想达到AB复制效果,再加一台做复制就行了。这个相信大家可以加一台做复制?。有什么问题请跟帖哈
参考
http://deidara.blog.51cto.com/400447/105875
http://blog.chinaunix.net/u2/66227/showart_1018701.html
作者: 健康木乃伊 时间: 2011-12-22 18:51
学习鸟 谢谢分享
欢迎光临 Chinaunix (http://bbs.chinaunix.net/) |
Powered by Discuz! X3.2 |