初始化同步数据块:(主节点操作)
主节点同步数据块到备节点
[root@node110 /]# drbdadm -- --overwrite-data-of-peerprimary data
[root@node110 /]# cat /proc/drbd
version: 8.4.4 (api:1/proto:86-101)
GIT-hash: 74402fecf24da8e5438171ee8c19e28627e1c98a buildby root@node110, 2016-11-27 15:34:16
0: cs:SyncSourcero:Primary/Secondary ds:UpToDate/Inconsistent C r-----
ns:128044 nr:0dw:0 dr:128709 al:0 bm:7 lo:6 pe:0 ua:6 ap:0 ep:1 wo:f oos:9637568
[>....................]sync'ed: 1.4% (9408/9536)M
finish:0:23:45 speed: 6,736 (6,736) K/sec
挂载DRBD0分区到系统目录:(主节点操作)
[root@node110 /]# mount /dev/drbd0 /mnt
[root@node110 /]# cd /mnt
[root@node110 mnt]# ls
[root@node110 mnt]# >rscpass
[root@node110 mnt]# echo "gmy">rscpass
[root@node110 mnt]# ll
total 4
-rw-r--r-- 1 root root 4 Nov 29 08:47 rscpass
[root@node110 mnt]# cat rscpass
gmy
从节点操作:
[root@node120 /]# cat /proc/drbd
version: 8.4.4 (api:1/proto:86-101)
GIT-hash: 74402fecf24da8e5438171ee8c19e28627e1c98a buildby root@node120, 2016-11-27 15:43:45
0: cs:Connectedro:Secondary/Primary ds:UpToDate/UpToDate C r-----
ns:0 nr:9765660dw:9765660 dr:0 al:0 bm:597 lo:0 pe:0 ua:0 ap:0 ep:1 wo:f oos:0
将从节点的从提升为主节点:
[root@node120 /]# drbdadm primary data
[root@node120 /]# cat /proc/drbd
version: 8.4.4 (api:1/proto:86-101)
GIT-hash: 74402fecf24da8e5438171ee8c19e28627e1c98a buildby root@node120, 2016-11-27 15:43:45
0: cs:Connectedro:Primary/Primary ds:UpToDate/UpToDate C r----- #主主模式
ns:0 nr:9765660dw:9765660 dr:665 al:0 bm:597 lo:0 pe:0 ua:0 ap:0 ep:1 wo:f oos:0
挂载从节点的DRBD0;(在备节点上操作)
[root@node120 /]# mount /dev/drbd0 /mnt
[root@node120 /]# cd /mnt
[root@node120 mnt]# ls
rscpass
[root@node120 mnt]# cat rscpass #可以看到同步过来的rscpass文件
gmy