DRBD의 제어에 필요한 모든 파라미터를 /etc/drbd.conf 에서 읽고, drbdsetup 및 drbdmeta의 프론트 앤드로써 동작.
커널에 로드 된 DRBD 모듈을 설정
DRBD 메타 데이터의 작성이나 변경, 덤프, 리스토어 등을 참조
# drbdadm -d adjust <resource name>
현재 관리가 필요한 내용의 세부 명령어를 보여줌
-d
옵션을 통해 실행하지 않고 명령어만 나열.
예시) DRBD를 시작하기 위해 필요한 하위 명령어
[root@hostname ~]# drbdadm -d adjust r0
drbdsetup new-resource r0 0
drbdsetup new-minor r0 0 0
drbdsetup new-peer r0 1 --_name=centos1 --protocol=C
drbdsetup new-path r0 1 ipv4:192.168.1.101:7789 ipv4:192.168.1.102:7789
drbdmeta 0 v09 /dev/sdb internal apply-al
drbdsetup attach 0 /dev/sdb /dev/sdb internal
drbdsetup connect r0 1
# drbdadm up {all | <resource name>}
DRBD를 처음 시작할 때 사용하는 명령어로 attach와 connect를 동시 실행
# drbdadm down {all | <resource name>}
DRBD를 종료 할 때 사용하는 명령어로 detach와 disconnect를 동시 실행
# drbdadm status {all | <resource name>}
DRBD의 현재 상태를 볼 때 사용
# drbdsetup new-resource <resource name> <volume number>
새로운 리소스 생성
예시)
[root@hostname ~]# drbdsetup new-resource r0 0
[root@hostname ~]# ps -ef | grep drbd
root 1552 2 0 10:07 ? 00:00:00 [drbd-reissue]
root 1557 2 0 10:09 ? 00:00:00 [drbd_w_r0]
root 1559 1522 0 10:10 pts/0 00:00:00 grep --color=auto drbd
[root@hostname ~]# drbdadm status
r0 role:Secondary
# drbdsetup new-minor <resource name> <minor number> <volume number>
새로운 가상 블록 장치 생성
예시)
[root@hostname ~]# drbdsetup new-minor r0 0 0
[root@hostname ~]# ps -ef | grep drbd
root 1552 2 0 10:07 ? 00:00:00 [drbd-reissue]
root 1557 2 0 10:09 ? 00:00:00 [drbd_w_r0]
root 1576 2 0 10:13 ? 00:00:00 [drbd0_submit]
root 1559 1522 0 10:10 pts/0 00:00:00 grep --color=auto drbd
[root@hostname ~]# drbdadm status
r0 role:Secondary
disk:Diskless
# drbdsetup new-peer <resource name> <node_id> <net_option>
리소스내에서 연결을 만든다. 그러기 위해서는 new-resource가 선행되어야 한다.
예시)
[root@hostname ~]# drbdsetup new-peer r0 1 --_name=centos1 --protocol=C
[root@hostname ~]# ps -ef | grep drbd
root 1552 2 0 10:07 ? 00:00:00 [drbd-reissue]
root 1557 2 0 10:09 ? 00:00:00 [drbd_w_r0]
root 1576 2 0 10:13 ? 00:00:00 [drbd0_submit]
root 1588 2 0 10:14 ? 00:00:00 [drbd_s_r0]
root 1583 1522 0 10:14 pts/0 00:00:00 grep --color=auto drbd
[root@hostname ~]# drbdadm status
r0 role:Secondary
disk:Diskless
centos1 connection:StandAlone
# drbdsetup new-path <resource name> <node_id> <local_IP> <remote_IP>
연결 경로를 만든다. 그러기 위해서는 new-peer가 선행되어야 한다.
예시)
[root@hostname ~]# drbdsetup new-path r0 1 ipv4:192.168.1.101:7789 ipv4:192.168.1.102:7789
[root@hostname ~]# ps -ef | grep drbd
root 1552 2 0 10:07 ? 00:00:00 [drbd-reissue]
root 1557 2 0 10:09 ? 00:00:00 [drbd_w_r0]
root 1576 2 0 10:13 ? 00:00:00 [drbd0_submit]
root 1588 2 0 10:14 ? 00:00:00 [drbd_s_r0]
root 1598 1522 0 10:17 pts/0 00:00:00 grep --color=auto drbd
[root@hostname ~]# drbdadm status
r0 role:Secondary
disk:Diskless
centos1 connection:StandAlone
# drbdsetup attach <minor number> <lower_dev> <meta_data_dev> <md 저장위치>
리소스 디바이스의 블록 디바이스 연결
예시)
[root@hostname ~]# drbdsetup attach 0 /dev/sdb /dev/sdb internal
[root@hostname ~]# ps -ef | grep drbd
root 1552 2 0 10:07 ? 00:00:00 [drbd-reissue]
root 1557 2 0 10:09 ? 00:00:00 [drbd_w_r0]
root 1576 2 0 10:13 ? 00:00:00 [drbd0_submit]
root 1588 2 0 10:14 ? 00:00:00 [drbd_s_r0]
root 1625 1522 0 10:59 pts/0 00:00:00 grep --color=auto drbd
[root@hostname ~]# drbdadm status
r0 role:Secondary
disk:UpToDate
centos1 connection:StandAlone
[root@hostname ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 16G 0 disk
├─sda1 8:1 0 1G 0 part /boot
└─sda2 8:2 0 15G 0 part
├─rhel-root 253:0 0 13.4G 0 lvm /
└─rhel-swap 253:1 0 1.6G 0 lvm [SWAP]
sdb 8:16 0 12T 0 disk
└─drbd0 147:0 0 4.7T 0 disk
sr0 11:0 1 4.2G 0 rom
# drbdsetup connect <resource name> <node_id>
리소스에 대응하는 네트워크 설정 유효화
예시)
[root@hostname ~]# drbdsetup connect r0 1
[root@hostname ~]# ps -ef | grep drbd
root 1552 2 0 10:07 ? 00:00:00 [drbd-reissue]
root 1557 2 0 10:09 ? 00:00:00 [drbd_w_r0]
root 1576 2 0 10:13 ? 00:00:00 [drbd0_submit]
root 1588 2 0 10:14 ? 00:00:00 [drbd_s_r0]
root 1642 2 0 11:01 ? 00:00:00 [drbd_r_r0]
root 1643 2 0 11:01 ? 00:00:00 [drbd_a_r0]
root 1644 2 0 11:01 ? 00:00:00 [drbd_as_r0]
root 1648 1522 0 11:01 pts/0 00:00:00 grep --color=auto drbd
[root@hostname ~]# drbdadm status
r0 role:Secondary
disk:UpToDate
centos1 role:Secondary
peer-disk:UpToDate
# drbdsetup status {<resource name>|}
DRBD 상태 간략 보기
예시)
[root@hostname ~]# drbdadm status
r0 role:Secondary
disk:UpToDate
centos1 role:Secondary
peer-disk:UpToDate
# drbdsetup status {<resource name>|} --v --s
DRBD 상태 상세 보기
예시)
[root@hostname ~]# drbdsetup status --v --s
r0 node-id:0 role:Secondary suspended:no
write-ordering:flush
volume:0 minor:0 disk:UpToDate backing_dev:/dev/sdb quorum:yes
size:5078124544 read:31916 written:4208 al-writes:1 bm-writes:2 upper-pending:0 lower-pending:0 al-suspended:no blocked:no
192.168.1.102:7789 node-id:1 connection:Connected role:Secondary congested:no ap-in-flight:0 rs-in-flight:0
volume:0 replication:Established peer-disk:UpToDate resync-suspended:no
received:48 sent:4156 out-of-sync:0 pending:0 unacked:0
# drbdsetup events2 {<resource name>|}
DRBD 실시간 상태 상세 보기
예시)
[root@hostname ~]# drbdsetup events2
exists peer-device name:r1 peer-node-id:1 conn-name:192.168.1.102:7790 volume:0 replication:Established peer-disk:UpToDate peer-client:no resync-suspended:no
exists path name:r1 peer-node-id:1 conn-name:192.168.1.102:7790 local:ipv4:192.168.1.101:7790 peer:ipv4:192.168.1.102:7790 established:yes
exists -
# drbdmeta <device> {v06|v07|v08|v09} <command> <cmd args...>
메타 데이터 관리 설정
예시)
[root@hostname ~]# drbdmeta 0 v09 /dev/sdb internal apply-al
[root@hostname ~]# ps -ef | grep drbd
root 1552 2 0 10:07 ? 00:00:00 [drbd-reissue]
root 1557 2 0 10:09 ? 00:00:00 [drbd_w_r0]
root 1576 2 0 10:13 ? 00:00:00 [drbd0_submit]
root 1588 2 0 10:14 ? 00:00:00 [drbd_s_r0]
root 1615 1522 0 10:56 pts/0 00:00:00 grep --color=auto drbd
[root@hostname ~]# drbdadm status
r0 role:Secondary
disk:Diskless
centos1 connection:StandAlone