Interface Guide

Interface Guide

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

 

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.

  • The query command prints a generic summary of the resource and prints verbose information if the -v option is included on the command line.

  • The control command is a command that can dynamically initiate and stop DRX on a resource basis.

  • The Notify command is a command that outputs the real-time status change situation occurring in DRX in resource units. It provides a function to perform once and receive events that occur until termination and output the result to the console.

 

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.

CLI List

 

Categorize

Item

Option

Command

Alias

Etc.

Categorize

Item

Option

Command

Alias

Etc.

query

DRX version

N/A

drx-ctl version

ver

drx version

DRX info

"

drx-ctl info

-

start or stop status of the DRX process

license

"

drx-ctl license

lic

license 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

-v

drx-ctl statistics [res|conn|all]

st

  • Statistical information

  • verbose mode (-v): Tx/Rx packet, compress/crypto Cur, Min, Max

BAB 

-v

drx-ctl memusage [res|conn|all] 

mem

  • BAB information

  • verbose mode (-v) : Begin, End, BAB Latency

log

N/A

drx-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.

notification

event notification

NA

drx-ctl events {conn|all}

-

event notification

 

Notification List

 

Event

Item

Type

타깃

DATA

설명

Event

Item

Type

타깃

DATA

설명

Common

Action

start

common

[start] 

Start Event Notification

stop

common

[stop] 

Stop Event Notification

shutdown

[success or fail]

Termination by command

Set

set

license

[temporary, permanent, invalid] 

Set specific license

loglevel

[none, trace, debug, info, warning, critical] 

log level (file, console)

Individual

connect

up

[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

Set

set

[connect name ]

compressor [none, zlib, lz4] [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

status

packet

[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

Considerations

  • DRX's control commands are performed asynchronously. That is, the point at which the CLI control command is executed and returned is not the final completion of the state control. Therefore, after executing the control command, it is necessary to check whether the status has changed normally through the inquiry command.

    • To determine if the state change has been completed, you must check the DRX events in real time after running the event notification command.

  • The drx-ctl command performs only one command at a time by default on the receiving drx server, which can cause a timeout for some queued commands if multiple commands are delivered simultaneously by DRX. To avoid timeouts, you need to ensure that the drx-ctl command is executed sequentially.

    • The return value of drx-ctl is as follows. 

      In Linux, the return value is limited to 0-255, so negative values are represented by adding 256.

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.

 

 

CLI output format

 

Query command

  • drx-ctl version

    • Option alias : ver

    • Print version information of DRX.

    • Setting example

      version

      < test version > [root@c69-r1 dgkim]# drx-ctl ver drx : Test version: Nov 29 2018, 16:13:46 [root@c69-r1 dgkim]# < Release version > [root@c69-r1 dgkim]# drx-ctl ver drx : 1.2(2018-11-29_16-52-41_TEST1) GIT-hash: b62c996 Nov 29 2018, 16:55:04 [root@c69-r1 dgkim]#
  • drx-ctl license

    • Option alias : lic

    • Outputs license information. 

    • Setting example

      license

      [root@c73-p1 drbd.d]# drx-ctl lic Product type : DRX License status : Temporary, Expire date: 30-nov-2018, Validity day: 9 [root@c73-p1 drbd.d]#
  • drx-ctl dump [res|all]

    • Outputs the settings of the resource and drx.conf. 

    • Enter resource because the drbdadm utility processes the resource configuration file.

    • The contents of drx.conf are output in "<DRX configuration>" and output in ini format (name = value).

    • Setting example

      dump

      [root@c73-p1 drbd.d]# drx-ctl dump all # /etc/drbd.conf global { usage-count yes; } common { } # resource r0 on c73-p1: ignored, not stacked # defined at /etc/drbd.d/r0.res:1 resource r0 { device /dev/drbd0 minor 0; disk /dev/sdd1; meta-disk /dev/sdb1; on c74-1 { node-id 1; } on c74-3 { node-id 3; } connection DR-1-3 { host c74-1 address ipv4 31.1.1.164:6677 via proxy on c73-p1 { inside ipv4 31.1.1.191:6678; outside ipv4 31.1.1.191:6679; } host c74-3 address ipv4 31.1.1.166:6677 via proxy on c73-p2 { inside ipv4 31.1.1.192:6678; outside ipv4 31.1.1.192:6679; } } net { protocol A; on-congestion pull-ahead; sndbuf-size 10M; congestion-fill 480M; } proxy { memlimit 500M; } } # resource r0-1 on c73-p1: ignored, not stacked # defined at /etc/drbd.d/r0.res:36 resource r0-1 { device /dev/drbd1 minor 1; disk /dev/sdd2; meta-disk /dev/sdb2; on c74-2 { node-id 2; } on c74-3 { node-id 3; } connection DR-2-3 { host c74-2 address ipv4 31.1.1.165:6680 via proxy on c73-p1 { inside ipv4 31.1.1.191:6681; outside ipv4 31.1.1.191:6682; } host c74-3 address ipv4 31.1.1.166:6680 via proxy on c73-p2 { inside ipv4 31.1.1.192:6681; outside ipv4 31.1.1.192:6682; } } net { protocol A; on-congestion pull-ahead; sndbuf-size 10M; congestion-fill 480M; } proxy { memlimit 500M; } } <DRX configuration> lang=korean proxy-type=1 loglevel-file=debug [root@c73-p1 drbd.d]#
  • drx-ctl show [res|conn|all]

    • Outputs the settings that are in use by the process. 

    • Global setting items are output in "<DRX configuration>" and output as ini format (name = value).

    • Node configuration items are output in tabular format for readability.

    • Setting example

      show

      [root@c73-p1 dgkim]# drx-ctl show all ----------------------------------------------------------------------- Name bwlimit min-raw-block-size compress level crypto ----------------------------------------------------------------------- DR-1-3-c73-p2-c73-p1 0 0 NONE 9 OPENSSL ----------------------------------------------------------------------- DR-2-3-c73-p2-c73-p1 0 0 LZ4 1 NONE ----------------------------------------------------------------------- <DRX configuration> language=korean base-dir=not set drbd-conf=not set connect-timeout=10 loglevel-file=debug loglevel-stdout=info logfile-max-size=10.00 MB logfile-max-count=10 performance-log-enable=disable ip-verification=on process-thread-count=auto [root@c73-p1 dgkim]#
  • drx-ctl connections [res|conn|all]

    • Option alias : co

    • verbose option : -v 

    • Outputs connection information for a resource.

      • normal mode : Omit IP Address, connect arrow output

      • verbose mode : Output IP address, omit connection arrow

    • Setting example

      connections

      < normal mode > [root@74-p1 ~]# drx-ctl co all ------------------------------------------------------------------------------------------------- Name Type local-drbd-ip State local-drx-ip State remote-drx-ip ------------------------------------------------------------------------------------------------- r0-74-p2-74-p1 meta (local-drbd) -established-> (local-drx) <-bridged----- (remote-drx) r0-74-p2-74-p1 data (local-drbd) <-established- (local-drx) -----bridged-> (remote-drx) ------------------------------------------------------------------------------------------------- All connections : 2, Established : 2 [root@74-p1 ~]# < verbose mode > [root@74-p1 ~]# drx-ctl co all -v ---------------------------------------------------------------------------------------------------------------------------------- Name Type local-drbd-ip State local-drx-ip State remote-drx-ip Up since ---------------------------------------------------------------------------------------------------------------------------------- r0-74-p2-74-p1 meta 31.1.1.121:8800 established 31.1.1.138:8801/31.1.1.138:8802 bridged 31.1.1.139:8802 - r0-74-p2-74-p1 data 31.1.1.121:8800 established 31.1.1.138:8801/31.1.1.138:8802 bridged 31.1.1.139:8802 2018-11-23 18:07:49 ---------------------------------------------------------------------------------------------------------------------------------- All connections : 2, Established : 2 [root@74-p1 ~]#
  • drx-ctl statistics [res|conn|all]

    • Option alias : st

    • normal mode : Outputs the average latency of TX speed/RX speed/Compress/Unlock/Encrypt. 

    • verbose mode : Outputs the current value, maximum value, and minimum value for RAW data/Compression/Decompression/Encryption of RX/TX. 

    • Filter output mode: Outputs the desired column.

    • The output unit(B, KB, MB, GB) is fixed to KiloBytes and is omitted. Values ​​less than KiloBytes are output as zero.

    • options

      • verbose option : v 

      • fileter option : --filter 

    • Abbreviation explanation

    • Setting example

      statistics

      < normal mode > C:\Users\Administrator>drx-ctl st all --------------------------------------------------------------- name type tx rx ratio cp-avg ec-avg dc-avg de-avg --------------------------------------------------------------- w1-w2-w16-2-w16-1 meta 0 0 w1-w2-w16-2-w16-1 data 0 0 0.00 0 0 0 0 --------------------------------------------------------------- All connections : 2, Established : 2 C:\Users\Administrator> < verbose mode > C:\Users\Administrator>drx-ctl st all -v ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- name type tx rx t-raw t-net r-raw r-net ratio cur best worst cp-avg cp-cur cp-min cp-max ec-avg ec-cur ec-min ec-max dc-avg dc-cur dc-min dc-max de-avg de-cur de-min de-max ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- w1-w2-w16-2-w16-1 meta 0 0 w1-w2-w16-2-w16-1 data 90 0 63118 63135 0 0 0.00 0.00 0.00 0.00 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- All connections : 2, Established : 2 C:\Users\Administrator> < filter mode > C:\Users\Administrator>drx-ctl st all -v --filter=name,tx,rx,cp-avg,cp-cur,cp-min,cp-max ---------------------------------------------------- name tx rx cp-avg cp-cur cp-min cp-max ---------------------------------------------------- w1-w2-w16-2-w16-1 0 0 w1-w2-w16-2-w16-1 0 0 0 0 0 0 ---------------------------------------------------- All connections : 2, Established : 2 C:\Users\Administrator>
  • drx-ctl memusage [res|conn|all] 

    • Outputs the BAB information for the resource.

    • The output unit(B, KB, MB, GB) is fixed to KiloBytes and is omitted. Values ​​less than KiloBytes are output as zero.

    • Option alias : mem

    • verbose option 

      • option : v

      • Outputs BAB Latency (TX, RX, compression / release) information of the connected resource. 

    • Setting example

      memusage

      < normal mode > [root@c73-p1 dgkim]# drx-ctl mem all -------------------------------------------------------------------------------------- Name Capacity Use (Size) Full Counts -------------------------------------------------------------------------------------- DR-1-3-c73-p2-c73-p1 716800 [>>>>>>>.....................] 23% (163277) 0 10240 [............................] 0% (0) - -------------------------------------------------------------------------------------- DR-2-3-c73-p2-c73-p1 512000 [............................] 0% (0) 0 10240 [............................] 0% (0) - -------------------------------------------------------------------------------------- Active bab counts : 2 <verbose mode> [root@c73-p1 dgkim]# drx-ctl mem all -v ---------------------------------------------------------------------------------------------------------- Name Capacity Begin End Use (Size) Full Counts ---------------------------------------------------------------------------------------------------------- DR-1-3-c73-p2-c73-p1 716800 340236152 504137496 [>>>>>>>.....................] 22% (160060) 0 10240 0 0 [............................] 0% (0) - ---------------------------------------------------------------------------------------------------------- DR-2-3-c73-p2-c73-p1 512000 64273922 64273922 [............................] 0% (0) 0 10240 0 0 [............................] 0% (0) - ---------------------------------------------------------------------------------------------------------- Active bab counts : 2 ---------------------------------------------------------------------------------------------------------- name Latency cur avg max min ---------------------------------------------------------------------------------------------------------- DR-1-3-c73-p2-c73-p1 TX BAB 00:00:00.000000 00:00:00.443516 00:00:06.765142 00:00:00.000101 RX BAB 00:00:00.000000 00:00:00.000000 00:00:00.000000 00:00:00.000000 Compress 00:00:00.000088 00:00:00.000087 00:00:00.001439 00:00:00.000001 Decompress 00:00:00.000000 00:00:00.000000 00:00:00.000000 00:00:00.000000 ---------------------------------------------------------------------------------------------------------- DR-2-3-c73-p2-c73-p1 TX BAB 00:00:00.000000 00:00:00.001627 00:00:00.004173 00:00:00.000261 RX BAB 00:00:00.000000 00:00:00.000000 00:00:00.000000 00:00:00.000000 Compress 00:00:00.000000 00:00:00.000113 00:00:00.001440 00:00:00.000001 Decompress 00:00:00.000000 00:00:00.000000 00:00:00.000000 00:00:00.000000 ---------------------------------------------------------------------------------------------------------- Active bab counts : 2 [root@c73-p1 dgkim]#
  • drx-ctl log  [res|conn|all] 

    • Outputs the contents of the log being recorded. 

    • options

      • If no options are entered, only the common (main) log is output.

      • Outputs a log of all resources or input resources.

      • m : output the main log.

      • n [number] : print the last n logs.

    • Setting example

      log

      < main log > [root@c69-r1 ~]# drx-ctl log Online mode. (main) I1126 08:50:17.448040 t30088 main] Resource create complete (success: 2, failed: 0) ^C[root@c69-r1 ~]# < resource log > [root@c69-r1 ~]# drx-ctl log r0 Online mode. (without main, r0-c69-r2-c69-r1) D1126 08:53:50.977215 t30109 r0-c69-r2-c69-r1:ad:o] <<=== drxp_type::ping ^C[root@c69-r1 ~]# [root@c69-r1 ~]# drx-ctl log r0_1 Online mode. (without main, r0_1-c69-r3-c69-r1) D1126 08:54:08.696168 t30133 r0_1-c69-r3-c69-r1:cd:o] <<=== drxp_type::ping D1126 08:54:14.707857 t30129 r0_1-c69-r3-c69-r1:am:o] ===>> send stream payload_len (16) meta D1126 08:54:14.708035 t30127 r0_1-c69-r3-c69-r1:am:o] <<=== drxp_type::stream (crypto:NONE) (compress:NONE) [16] D1126 08:54:14.708129 t30128 r0_1-c69-r3-c69-r1:am:o] ===>> send stream payload_len (16) meta D1126 08:54:14.708208 t30127 r0_1-c69-r3-c69-r1:am:o] <<=== drxp_type::stream (crypto:NONE) (compress:NONE) [16] ^C[root@c69-r1 ~]# < All logs of common and resources > [root@c69-r1 ~]# drx-ctl log -m all Online mode. (main, r0-c69-r2-c69-r1, r0_1-c69-r3-c69-r1) D1126 08:54:24.708287 t30126 r0_1-c69-r3-c69-r1:am:o] <<=== drxp_type::stream (crypto:NONE) (compress:NONE) [16] ^C[root@c69-r1 ~]# [root@c69-r1 ~]# < prints the last 10 logs and all logs (common, resources) > [root@c69-r1 ~]# drx-ctl log -m -n 10 all Online mode. (main, r0-c69-r2-c69-r1, r0_1-c69-r3-c69-r1) D1126 08:54:34.708110 t30129 r0_1-c69-r3-c69-r1:am:o] <<=== drxp_type::stream (crypto:NONE) (compress:NONE) [16] D1126 08:54:34.708215 t30126 r0_1-c69-r3-c69-r1:am:o] ===>> send stream payload_len (16) meta D1126 08:54:34.708425 t30127 r0_1-c69-r3-c69-r1:am:o] <<=== drxp_type::stream (crypto:NONE) (compress:NONE) [16] D1126 08:54:38.992691 t30114 r0-c69-r2-c69-r1:cm:o] <<=== drxp_type::stream (crypto:NONE) (compress:NONE) [16] D1126 08:54:38.992832 t30114 r0-c69-r2-c69-r1:cm:o] ===>> send stream payload_len (16) meta D1126 08:54:40.696530 t30131 r0_1-c69-r3-c69-r1:cd:o] <<=== drxp_type::ping D1126 08:54:44.707844 t30127 r0_1-c69-r3-c69-r1:am:o] ===>> send stream payload_len (16) meta D1126 08:54:44.708060 t30129 r0_1-c69-r3-c69-r1:am:o] <<=== drxp_type::stream (crypto:NONE) (compress:NONE) [16] D1126 08:54:44.708151 t30126 r0_1-c69-r3-c69-r1:am:o] ===>> send stream payload_len (16) meta D1126 08:54:44.708223 t30129 r0_1-c69-r3-c69-r1:am:o] <<=== drxp_type::stream (crypto:NONE) (compress:NONE) [16] ^C[root@c69-r1 ~]# [root@c69-r1 ~]#

Control

  • drx-ctl up [res|conn|all]

    • the input resource is up. 

    • Setting example

      up

      < resource up > [root@c73-p1 dgkim]# drx-ctl up r0 DR-1-3-c73-p2-c73-p1: up. Result: 1 resource(s) up. [root@c73-p1 dgkim]# < all resource up > [root@c73-p1 dgkim]# drx-ctl up all DR-1-3-c73-p2-c73-p1: up. DR-2-3-c73-p2-c73-p1: up. Result: 2 resource(s) up. [root@c73-p1 dgkim]#
  • drx-ctl down [res|conn|all]

    • the input resource is down.

    • Setting example

      down

      < resource down > [root@c73-p1 dgkim]# drx-ctl down r0 DR-1-3-c73-p2-c73-p1: resource down. Result: 1 resource(s) down. [root@c73-p1 dgkim]# < resource down > [root@c73-p1 dgkim]# drx-ctl down all DR-1-3-c73-p2-c73-p1: resource down. DR-2-3-c73-p2-c73-p1: resource down. Result: 2 resource(s) down. [root@c73-p1 dgkim]#
  • drx-ctl adjust [res|conn|all] 

    • The active resource is updated, and the inactive resource is started.

    • Setting example

      adjust

      [root@c73-p1 drbd.d]# drx-ctl adjust all DR-1-3-c73-p2-c73-p1: up. DR-2-3-c73-p2-c73-p1: up. Result: 2 resource(s) updated. [root@c73-p1 drbd.d]#
    • The BAB size of the active resource can not be changed.

    • Error 

      adjust error

      [root@c73-p1 drbd.d]# drx-ctl adjust all DR-1-3-c73-p2-c73-p1:ad: Can't change memory limit of active resource. DR-1-3-c73-p2-c73-p1:cm: Can't change memory limit of active resource. DR-1-3-c73-p2-c73-p1: updated. DR-2-3-c73-p2-c73-p1: updated. Result: 2 resource(s) updated. [root@c73-p1 drbd.d]#