3、接下来在两台服务器上同时操作
1、在主服务器和从属服务器上同时启动drbd服务:
主服务器:[root@master drbd.d]# service drbd start
从属服务器:[root@slave drbd.d]# service drbd start
2、查看两台服务器上的drbd状态:
master:
[root@master ~]# drbd-overview
0:web Connected Secondary/Secondary Inconsistent/Inconsistent C r----
[root@master drbd.d]# cat /proc/drbd
version: 8.3.8 (api:88/proto:86-94)
GIT-hash: d78846e52224fd00562f7c225bcc25b2d422321d build by mockbuild@builder10.CentOS.org, 2010-06-04 08:04:16
0: cs:Connected ro: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 ep:1 wo:b oos:987928
slave
[root@slave ~]# drbd-overview
0:web Connected Secondary/Secondary Inconsistent/Inconsistent C r----
[root@slave drbd.d]# cat /proc/drbd
version: 8.3.8 (api:88/proto:86-94)
GIT-hash: d78846e52224fd00562f7c225bcc25b2d422321d build by mockbuild@builder10.centos.org, 2010-06-04 08:04:16
0: cs:Connected ro: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 ep:1 wo:b oos:987928
可知两台服务器都为Secondary状态,证明还没有同步。
创建文件夹
[root@master ~]# mkdir /data
[root@slave ~]# mkdir /data
3、在master上操作:
[root@master ~]# cd /etc/drbd.d/
[root@master drbd.d]# drbdadm -- --overwrite-data-of-peer primary web
[root@master drbd.d]# drbd-overview
0:web SyncSource Primary/Secondary UpToDate/Inconsistent C r----
[====>...............] sync'ed: 26.5% (732280/987928)K delay_probe: 25
格式化:
[root@master drbd.d]# mkfs -t ext3 -L drbdweb /dev/drbd0
挂载:
[root@master drbd.d]# mkdir /mnt/1
[root@master drbd.d]# mount /dev/drbd0 /mnt/1
[root@master drbd.d]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 9.7G 2.6G 6.7G 28% /
/dev/sda1 99M 12M 83M 12% /boot
tmpfs 97M 0 97M 0% /dev/shm
/dev/hdc 2.8G 2.8G 0 100% /mnt/cdrom
/dev/drbd0 950M 18M 885M 2% /mnt/1
再次查看两台服务器的状态:
master:
[root@master drbd.d]# service drbd status
drbd driver loaded OK; device status:
version: 8.3.8 (api:88/proto:86-94)
GIT-hash: d78846e52224fd00562f7c225bcc25b2d422321d build by mockbuild@builder10.centos.org, 2010-06-04 08:04:16
m:res cs ro ds p mounted fstype
0:web Connected Primary/Secondary UpToDate/UpToDate C /mnt/1 ext3
slave
[root@slave drbd.d]# service drbd status
drbd driver loaded OK; device status:
version: 8.3.8 (api:88/proto:86-94)
GIT-hash: d78846e52224fd00562f7c225bcc25b2d422321d build by mockbuild@builder10.centos.org, 2010-06-04 08:04:16
m:res cs ro ds p mounted fstype
0:web Connected Secondary/Primary UpToDate/UpToDate C
可知master为主服务,salve为从属,此时已经同步。
DRBD+Heartbeat+NFS实现Linux高可用群集(HA)(4)
内容版权声明:除非注明,否则皆为本站原创文章。
转载注明出处:http://www.heiqu.com/f4e6da8fa84110e4e513807b03a98bd9.html