Disk balancer CLI commands

The disk balancer operations are manually triggered and managed using the ozone admin datanode diskbalancer command.

Use the following CLI commands to manage and monitor the Disk Balancer service:

  • To start the service:
    ozone admin datanode diskbalancer start
  • To stop the service:
    ozone admin datanode diskbalancer stop
  • To update the configuration:
    ozone admin datanode diskbalancer update
  • To check the status of the service:
    ozone admin datanode diskbalancer status

    Running the status command displays the following information:

    Field name Description
    Datanode Name or IP address of the target node.
    Status Current execution state of the process (example, RUNNING, STOPPED, or PAUSED).
    Threshold(%) Configured imbalance threshold percentage for triggering disk balancing.
    BandwidthInMB Maximum bandwidth allocated to the operation in megabytes per second.
    Threads Number of active concurrent worker threads assigned to the process (Number of threads = Number of containers moved parallely).
    StopAfterDiskEven Boolean flag indicating if execution halts once disk usage balances evenly (true or false).
    ContainerStates Displays which container is eligible for the move process. (by default, CLOSED or QUASI_CLOSED).
    SuccessMove Total count of successfully relocated containers or data blocks.
    FailureMove Total count of failed container or block relocation attempts.
    BytesMoved(MB) Volume of data successfully transferred so far, measured in megabytes.
    EstBytesToMove(MB) Remaining volume of data estimated to move, measured in megabytes.
    EstTimeLeft(min) Calculated time remaining until job completion, measured in minutes.
  • To get the report of the service:
    ozone admin datanode diskbalancer report

    The report command output displays the volume details for each DataNode.

    Sample output:
    Datanode: 59c14bfa-1ccd-45e4-83e6-8c2c3a5de873
    Aggregate VolumeDataDensity: 0.00%
    IdealUsage: 8.00% | Threshold: 10.00% | ThresholdRange: (0.00%, 18.00%)
    
    Volume Details:
    
    StorageID                               | StoragePath     | OzoneCapacity | OzoneAvailable | OzoneUsed | ContainerPreAllocatedSpace | EffectiveUsedSpace | Utilization | VolumeDensity
    DS-57df847c-49a9-4b3e-84a5-b851bc58e2be   /data/hdds/hdds   1006.75 GB      926.22 GB        4.18 MB     0 B                          80.53 GB             8.00%         0.00%

The following table details the command-line options, descriptions, and usage examples available for Disk Balancer CLI operations.

Table 1. Disk Balancer command options
Option Description Example
[***DATANODE-ADDRESS***]
One or more Datanode addresses as positional arguments. Addresses can be:
  • Hostname (example, DN-1): uses default CLIENT_RPC port (19864)
  • Hostname with port (example, DN-1:19864)
  • IP address (example, 192.168.1.10)
  • IP address with port (example, 192.168.1.10:19864)
  • Stdin (-): Reads DataNode addresses from standard input, one per line

DN-1

DN-1:19864

192.168.1.10

-

--in-service-datanodes Queries SCM for all IN_SERVICE DataNodes and executes the command on all of them. --in-service-datanodes
--json Formats command output as JSON. --json
-t or --threshold-percentage Volume density threshold percentage (default: 10.0). Used with start and update commands.

-t 5

--threshold-percentage 5.0

-b or --bandwidth-in-mb Maximum disk bandwidth in MB/s (default: 10). Used with start and update commands.

-b 20

--bandwidth-in-mb 50

-p or --parallel-thread Number of parallel threads (default: 5). Used with start and update commands.

-p 5

--parallel-thread 10

-s or --stop-after-disk-even Automatically stops the balancer after disks are balanced (default: true). Used with start and update commands.

-s false

--stop-after-disk-even true

-c or --container-states Comma-separated list of container lifecycle state names eligible to be moved between disks. Used with start and update commands.

-c CLOSED,QUASI_CLOSED

--container-states CLOSED

Example commands:

  • Start disk balancer:
    • Start disk balancer on multiple DataNodes:
      ozone admin datanode diskbalancer start DN-1 DN-2 DN-3
    • Start disk balancer on all IN_SERVICE and HEALTHY DataNodes:
      ozone admin datanode diskbalancer start --in-service-datanodes
    • Start disk balancer with configuration parameters:
      ozone admin datanode diskbalancer start DN-1 -t 5 -b 20 -p 5

      Or using the long form:

      ozone admin datanode diskbalancer start DN-1 --threshold-percentage 5 -b 20 -p 5
    • Read datanode addresses from stdin:
      echo -e "DN-1\nDN-2" | ozone admin datanode diskbalancer start -
    • Start disk balancer with json output:
      ozone admin datanode diskbalancer start DN-1 --json
  • Stop disk balancer:
    • Stop disk balancer on multiple DataNodes:
      ozone admin datanode diskbalancer stop DN-1 DN-2 DN-3
    • Stop disk balancer on all IN_SERVICE and HEALTHY DataNodes:
      ozone admin datanode diskbalancer stop --in-service-datanodes
    • Stop disk balancer with JSON output:
      ozone admin datanode diskbalancer stop DN-1 --json
  • Update disk balancer configuration:
    • Update multiple parameters:
      ozone admin datanode diskbalancer update DN-1 -t 5 -b 50 -p 10
    • Update on all IN_SERVICE and HEALTHY DataNodes:
      ozone admin datanode diskbalancer update --in-service-datanodes -t 5

      Or using the long form:

      ozone admin datanode diskbalancer update --in-service-datanodes --threshold-percentage 5
    • Update with JSON output:
      ozone admin datanode diskbalancer update DN-1 -b 50 --json
  • Get disk balancer status:
    • Get status from multiple DataNodes:
      • ozone admin datanode diskbalancer status DN-1 DN-2 DN-3
    • Get status from all IN_SERVICE and HEALTHY DataNodes:
      ozone admin datanode diskbalancer status --in-service-datanodes
    • Get status in JSON format:
      ozone admin datanode diskbalancer status --in-service-datanodes --json
  • Get disk balancer report:
    • Get report from multiple DataNodes:
      ozone admin datanode diskbalancer report DN-1 DN-2 DN-3
    • Get report from all IN_SERVICE and HEALTHY DataNodes:
      ozone admin datanode diskbalancer report --in-service-datanodes
    • Get report in JSON format:
      ozone admin datanode diskbalancer report --in-service-datanodes --json