drbd的快速初始化

需求

默认启动drbd后,两个设备需要进行同步,而某些测试情况下,设备是空的,并不需要同步,都是空的就不需要同步了,但是系统自身是不会判断是否为空的,需要按下面的步骤处理一下

操作方法

1、两台机器上面都执行初始化元数据

1
drbdadm create-md <resource>

2、两台设备上面都执行启动

1
drbdadm up <resource>

3、在备用节点上面执行清理操作

1
drbdadm -- --clear-bitmap new-current-uuid <resource>

4、在主节点上面执行设置主的操作

1
drbdadm primary <resource>

5、检查设备同步情况

1
drbdadm status <resource>

上面的操作后,主备的设备就是同步状态了,在测试场景下,能够节约不少时间

查看连接的情况

1
2
3
4
5
[root@node152 drbd.d]# cat /sys/kernel/debug/drbd/resources/r0/connections/node153/0/proc_drbd
1: cs:Established ro:Primary/Secondary ds:UpToDate/UpToDate A r-----
ns:0 nr:0 dw:0 dr:260304 al:0 bm:0 lo:0 pe:[0;0] ua:0 ap:[0;0] ep:1 wo:1 oos:0
act_log: used:0/1237 hits:0 misses:0 starving:0 locked:0 changed:0
blocked on activity log: 0/0/0

查看连接的协议
比如下面的我们需要使用rdma的

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
[root@node152 drbd.d]# cat /sys/kernel/debug/drbd/resources/r0/connections/node153/transport
v: 0

data stream
corked: 0
unsent: 0 bytes
allocated: 0 bytes
control stream
corked: 0
unsent: 0 bytes
allocated: 0 bytes

transport_type: rdma
v: 0

192.168.19.152 - 192.168.19.153: CONNECTED
data field: posted alloc desired max
tx_descs: 0 258
peer_rx_descs: 132 (receive window at peer)
rx_descs: 133 133 129 258
rx_peer_knows: 132 (what the peer knows about my receive window)

control field: posted alloc desired max
tx_descs: 0 8
peer_rx_descs: 3 (receive window at peer)
rx_descs: 4 4 4 8
rx_peer_knows: 3 (what the peer knows about my receive window)