• Describes the DRX's CLI commands and explains the application considerations from a programming perspective.


1. Summary

The DRX CLI is divided into status inquiries and control / notification commands for the replicated resources and provides the same interface regardless of platform through the drx-ctl utility.


2. CLI 

The DRX's CLI is divided into views, controls, and notifications.

The command format of the CLI is drx-ctl {option} [command] [command argument ...]. The output type is determined by "command" and "command argument", and "option" for selecting the detail mode (-v) can be omitted. "Command argument" can use the connection name and "resource".

The output format of the CLI depends on the "command" and you can use "command arguments" to specify the desired output items.

2.1 CLI List


CategorizeItemOptionCommandAliasEtc.
queryDRX versionN/Adrx-ctl versionverdrx version
DRX info"drx-ctl info-start or stop status of the DRX process
license"drx-ctl licenseliclicense info
resource configuration"drx-ctl dump [res|all]-
  • resource configuration, drx.conf
  • Since resource configuration file is processed by drbdadm, enter resource.
information during up"drx-ctl show [res|conn|all]-Configuration information during up.
connection-v

drx-ctl connection [res|conn|all]

co
  • connection information
  • verbose mode (-v): IP, Up Since, Remove arrow
statistics-vdrx-ctl statistics [res|conn|all]st
  • Statistical information
  • verbose mode (-v): Tx/Rx packet, compress/crypto Cur, Min, Max
BAB -vdrx-ctl memusage [res|conn|all] mem
  • BAB information
  • verbose mode (-v) : Begin, End, BAB Latency
logN/Adrx-ctl log  [connect name or main] -
  • Output the currently logged log file
  • Rolled log files are not output.
control

resource up"drx-ctl up [res|conn|all]-up resource 
resource down"drx-ctl down [res|conn|all]-down resource
resource adjust"drx-ctl adjust [res|conn|all] -update resources
compress"drx-ctl set compress [type] [level] [res|conn|all] -Resource Compression Settings
crypto"drx-ctl set crypto [on or off] [res|conn|all] -Resource Encryption Settings
bwlimit"drx-ctl set bwlimit [limit] [res|conn|all] -
  • unit : Bytes Per Second (K, M, G available)
  • limit : Bandwidth of input resource

"drx-ctl set license [file-path]-
  • file-path : License file path.
  • Validate the license on the specified path and replace it.
  • When replacing with a valid license, the terminated DRX is retained.
reset statistics"drx-ctl reset statistics [res|conn|all] st
  • Option alias : statistics is only st.
notificationevent notificationNAdrx-ctl events {conn|all}-event notification


2.2 Notification List


EventItemType타깃DATA설명
CommonActionstartcommon[start] Start Event Notification
stopcommon[stop] Stop Event Notification
shutdown[success or fail]Termination by command
Setsetlicense[temporary, permanent, invalid] Set specific license
loglevel[none, trace, debug, info, warning, critical] log level (file, console)
Individualconnectup[connect name ][success or fail] connection activation result
down[connect name ][success or fail] connection deletion result
[drx or drbd]_accept[connect name ][IP:Port] accept result
[accept or connector]_state[connect name ]

[stopped/stopping, waiting, bridging/bridged, 

connecting/connected, establishing/established] 

  • Connection Status and Results
  • add the state subject and connect name
Setset[connect name ]compressor [none, zlib, lz4, qat] [level] compression settings
[connect name ]crypto [none, openssl] encryption settings
[connect name ]bwlimit [size] bandwidth of resource
reset[connect name ][success or fail] reset statistics
statuspacket[connect name ][receive_fail] [origin size] [receive size] 

notification of failure only

compress[connect name ][compress or decompress]_fail [origin size] [receive size] [return value]

notification of failure only

crypto[connect name ][encrypto or decrypto]_fail [origin size] [receive size] [return value]

notification of failure only

3. Considerations


4. Operation 

DRX configures the resource information into a file and controls each resource with the drx-ctl command.

The following are typical examples of configuring and starting replication resources.

  1. configures the resource
  2. start DRX service.
  3. Reset the BAB size incorrectly.
    1. Performs a "down" operation on resource r0.
    2. Change BAB size of resource r0 to 700M
    3. Performs a "up" operation on resource r0.
  4. Apply LZ4 compression algorithm to active resources
    1. Enter "drx-ctl set compress lz4 1 r0" command
    2. Use "drx-ctl mem r0" command to check BAB usage rate of resource r0
    3. To permanently apply compression settings, add settings to the resource file.



5. CLI output format


5.1 Query command

5.2 control

5.3 Notification

The event that occurred in DRX process can be received through the client (drx-ctl).

EventTypeDescriptionExample
Commonstartnotification started


[root@c73-p1 drbd.d]# drx-ctl events 
[system] connected
[2018-11-27 11:22:38.933] start common


stopend of notification


[2018-11-27 11:12:39.098] stop common


shutdownexit by command


[2018-11-27 11:12:39.076] shutdown success


set licenseLicense settings.
  • temporary, permanent, invalid
[2018-11-27 13:17:58.806] set license temporary


set loglevellog level (file, console)


[2018-11-27 13:44:31.681] set loglevel-file trace
[2018-11-27 13:44:41.496] set loglevel-file debug
[2018-11-27 13:44:44.328] set loglevel-file info
[2018-11-27 13:44:46.088] set loglevel-file warning
[2018-11-27 13:44:47.968] set loglevel-file error
[2018-11-27 13:44:48.104] set loglevel-file critical
[2018-11-27 13:44:57.776] set loglevel-file off


Individualupactivate


[2018-11-27 13:50:29.151] up DR-1-3-c73-p2-c73-p1 success


downinactivate


[2018-11-27 13:46:37.141] down DR-1-3-c73-p2-c73-p1 success


acceptIP Accept 결과


[2018-11-27 13:50:29.659] drx_accept DR-1-3-c73-p2-c73-p1 31.1.1.192:33476
[2018-11-27 13:50:34.298] drbd_accept DR-1-3-c73-p2-c73-p1 31.1.1.164:40557


connconnection status


[2018-11-27 14:23:39.120] acceptor_state DR-1-3-c73-p2-c73-p1 bridging
[2018-11-27 14:23:39.121] connector_state DR-1-3-c73-p2-c73-p1 bridging
[2018-11-27 14:23:39.123] connector_state DR-1-3-c73-p2-c73-p1 bridged
[2018-11-27 14:23:39.222] connector_state DR-1-3-c73-p2-c73-p1 connecting
[2018-11-27 14:23:39.328] acceptor_state DR-1-3-c73-p2-c73-p1 bridged
[2018-11-27 14:23:39.422] acceptor_state DR-1-3-c73-p2-c73-p1 waiting
[2018-11-27 14:23:43.960] acceptor_state DR-1-3-c73-p2-c73-p1 connected
[2018-11-27 14:23:43.960] acceptor_state DR-1-3-c73-p2-c73-p1 establishing
[2018-11-27 14:23:44.038] acceptor_state DR-1-3-c73-p2-c73-p1 established
[2018-11-27 14:23:44.069] connector_state DR-1-3-c73-p2-c73-p1 establishing
[2018-11-27 14:23:44.069] connector_state DR-1-3-c73-p2-c73-p1 established


setcompressor


[2018-11-27 15:27:26.895] set DR-1-3-c73-p2-c73-p1 compressor NONE
[2018-11-27 15:27:50.308] set DR-1-3-c73-p2-c73-p1 compressor LZ4 1
[2018-11-27 15:30:34.584] set DR-1-3-c73-p2-c73-p1 compressor ZLIB 1
[2018-11-27 17:48:31.204] set DR-1-3-c73-p2-c73-p1 compressor IQA 1


crypto


[2018-11-27 17:50:32.851] set DR-1-3-c73-p2-c73-p1 crypto OPENSSL
[2018-11-27 17:50:46.264] set DR-1-3-c73-p2-c73-p1 crypto NONE


Bandwidth


[2018-11-27 17:56:07.698] set DR-1-3-c73-p2-c73-p1 bwlimit 1073741824
[2018-11-27 17:58:12.380] set DR-1-3-c73-p2-c73-p1 bwlimit 104857600


resetreset statistics


[2018-11-27 17:58:52.962] reset DR-1-3-c73-p2-c73-p1 success


packet

transmit / receive failure


[2018-11-28 11:12:19.953] packet DR-1-3-c73-p2-c73-p1 receive_fail 15 15


compress

Prints the failure.


[2018-11-28 09:43:04.543] compress DR-1-3-c73-p2-c73-p1 compress_fail 80 1048576 0
[2018-11-28 10:28:30.629] compress DR-1-3-c73-p1-c73-p2 decompress_fail 47 1048576 0


crypto

Prints the failure.


[2018-11-28 10:28:42.186] crypto DR-2-3-c73-p2-c73-p1 encrypto_fail 41 1048576 48
[2018-11-28 10:28:42.081] crypto DR-2-3-c73-p1-c73-p2 decrypto_fail 96 1048576 80