Routine Management of DRBD
DRBD is a software-implemented, non-shared, storage and replication solution for image block device content between servers. DRBD is composed of kernel modules and related scripts to build highly available clusters. In a highly available cluster environment, although DRBD disk resources are taken over by the cluster management component as a cluster service, it is necessary to master Common commands of DRBD. This article describes some common daily management commands of DRBD for your reference.
For more information about DRBD, see:
DRBD principles and features
Rapid installation and deployment of DRBD
1. DRBD user space management tools
Drbdadm: a high-level DRBD program management suite tool. It obtains all configuration parameters from the configuration file/etc/drbd. conf. Drbdadm serves as the front-end application of the program for the drbdsetup and drbdeta commands. The drbdadm command is actually executed by the drbdsetup and drbdeta commands. Drbdsetup: drbdsetup allows you to configure the DRBD module that has been loaded into the kernel. It is the underlying DRBD program management suite tool. When using this command, all configuration parameters must be defined directly in the command line. Although the command is flexible, it greatly reduces the ease of use of the command. Therefore, many users seldom use debdsetup. Drbdmeta: drbdmeta allows users to create, dump, restore, and modify the original data structure of drbd. This command is rarely used by users.
### Obtain drbdadm help # drbdadm USAGE: drbdadm [OPTION...] [-- DRBDSETUP-OPTION...] COMMAND {all | RESOURCE ...} OPTIONS: {-- stacked |-S }### Author: Leshami {-- dry-run |-d }## Blog: http://blog.csdn.net/leshami {-- verbose |-v} {-- config-file |-c} val {-- config-to-test |-t} val {-- drbdsetup |-s} val {-- drbdmeta |-m} val {-- drbd-proxy-ctl |-p} val {-- sh-varname |-n} val {-- force |-f} {-- peer |- p} val {-- version |-V} COMMANDS: attach detach connect disconnect up down primary secondary invalidate-remote outdate resize syncer verify pause-sync resume-sync adjust wait-connect wait-con-int role cstate dstate dump-xml create- md show-gi get-gi dump-md wipe-md hidden-commands ### view the connection status # drbdadm cstate allConnected ### view the resource role # drbdadm role allPrimary/Secondary ## # viewing disk status # drbdadm dstate allUpToDate/UpToDate more related status values, role value and other detailed descriptions: http://drbd.linbit.com/users-guide-8.4/?##### drbdadm up ### Resource disabling # drbdadm down ### Resource upgrade # drbdadm primary ### Resource downgrade # drbdadm secondary
Ii. Use of other DRBD tools
1. view the drbd Service
# service drbd statusdrbd driver loaded OK; device status:version: 8.3.15 (api:88/proto:86-97)GIT-hash: 0ce4d235fc02b5c53c1c52c53433d11a694eab8c build by [email protected], 2015-10-31 10:58:13m:res cs ro ds p mounted fstype0:redisk Connected Primary/Secondary UpToDate/UpToDate C /data ext3
2. Run the drbd-overview command.
# /usr/local/drbd/sbin/drbd-overview 0:redisk Connected Primary/Secondary UpToDate/UpToDate C r----- /data ext3 1004M 18M 936M 2%
3. view the/proc/drbd File
# Cat/proc/drbdversion: 8.3.15 (api: 88/proto: 86-97) ## version, GIT-hash: build by [email protected], 10:58:13 0: cs: Connected ro: Primary/Secondary ds: UpToDate/UpToDate C r ----- ns: 56 nr: 0 dw: 56 dr: 1181 al: 3 bm: 0 lo: 0 pe: 0 ua: 0 ap: 0 ep: 1 wo: f oos: 0 device number status role (current/peer) disk status and protocol, I/O status ----------------------------------------------------------------- ---- 0: cs: Connected ro: Primary/Secondary ds: UpToDate/UpToDate C r ----- I/O status includes 6 types: 1 ). i/O suspension, r indicates running I/O, s indicates sushortded I/O, normally r 2 ). serial resynchronization: when the resource is waiting for synchronization, the re-synchronization is postponed. This mark is changed to A, and the normal situation is-3 ). synchronization pause initiated by the Peer-initiated sync suspension Peer node: when the resource is waiting for re-synchronization, the wait node initiates a pause for some reasons. This sign is changed to p. Normally-4). Locally initiated sync suspension local-initiated synchronization pause: when the resource is waiting for re-synchronization, the user initiates a synchronization pause at the local node, which indicates that the synchronization is u. -5). Locally blocked I/O. -Is normal -. It may be the following sign: d: I/O blocking occurs in the drbd due to a short disk status. B: I/O blocking of the standby device. n: network socket congestion a: a combination of device I/O congestion and network congestion 6 ). activity Log update suspension Activity Log update pause: When Activity Log update is paused, this flag changes to s. Normal-second behavior performance indicator ns: 56 nr: 0 dw: 56 dr: 1181 al: 3 bm: 0 lo: 0 pe: 0 ua: 0 ap: 0 ep: 1 wo: f oos: 0 NS (sent by network send): net data is sent to the peer node NR (received by network receive network) using kibyte through network connection ): network connection to kibyte to receive net data DW (disk write): net data to kibyte to write to local disk DR (disk read ): net data read local disk data using kibyte AL (activity log): metadata update BM in the activity log area (bit map Bitmap): metadata update LO in the bitmap area (local count): number of open local I/O sub-systems for DRBD requests PE (pengding to be determined): Number of requests sent to the peer node but not answered by the peer node UA (unacknowledged unconfirmed): requests from the peer node are received through network connections, but no response AP (alllication pending application hangs): The data block I/O request is forwarded to DRBD, but DRBD has not yet answered EP (epochs): a certain number of epoch objects, it is usually 1, and I/O load may be increased when the method is blocked or there is no sort write. WO (write order) methods currently used for writing order: B (barrier obstacle), (f flush refresh), d (drain leakage), or n (none) OOS (out of sync): synchronizes the current storage with kububyte
Iii. Master-slave role switching of DRBD
1. master server operations
To detach a drbd disk that has been mounted to the master server, you can use lsof | grepdrbd to check which processes are using files in the drbd partition, disable it # umount/data switch the master service role of drbd to the slave server role # drbdadm secondary redisk
2. slave server operations
Upgrade drbd from service role to master server role # Mount drbd partition to drbdadm primary redisk. The-o noatime parameter will disable the Update file atime operation caused by access, disk I/O performance # mount-o noatime/dev/drbd0/data