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 statusRunning the status command displays the following information:
Field name Description DatanodeName or IP address of the target node. StatusCurrent execution state of the process (example, RUNNING,STOPPED, orPAUSED).Threshold(%)Configured imbalance threshold percentage for triggering disk balancing. BandwidthInMBMaximum bandwidth allocated to the operation in megabytes per second. ThreadsNumber of active concurrent worker threads assigned to the process (Number of threads = Number of containers moved parallely). StopAfterDiskEvenBoolean flag indicating if execution halts once disk usage balances evenly ( trueorfalse).ContainerStatesDisplays which container is eligible for the move process. (by default, CLOSEDorQUASI_CLOSED).SuccessMoveTotal count of successfully relocated containers or data blocks. FailureMoveTotal 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 reportThe 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.
| Option | Description | Example |
|---|---|---|
[***DATANODE-ADDRESS***] |
One or more Datanode addresses as positional arguments. Addresses can be:
|
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. |
|
-b or --bandwidth-in-mb |
Maximum disk bandwidth in MB/s (default: 10). Used with
start and update commands. |
|
-p or --parallel-thread |
Number of parallel threads (default: 5). Used with
start and update commands. |
|
-s or --stop-after-disk-even |
Automatically stops the balancer after disks are balanced (default:
true). Used with start and update
commands. |
|
-c or --container-states |
Comma-separated list of container lifecycle state names eligible to be moved between
disks. Used with start and update commands. |
|
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_SERVICEandHEALTHYDataNodes: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 5Or 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
- Start disk balancer on multiple DataNodes:
- 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_SERVICEandHEALTHYDataNodes:ozone admin datanode diskbalancer stop --in-service-datanodes - Stop disk balancer with JSON
output:
ozone admin datanode diskbalancer stop DN-1 --json
- Stop disk balancer on multiple
DataNodes:
- Update disk balancer configuration:
- Update multiple
parameters:
ozone admin datanode diskbalancer update DN-1 -t 5 -b 50 -p 10 - Update on all
IN_SERVICEandHEALTHYDataNodes:ozone admin datanode diskbalancer update --in-service-datanodes -t 5Or 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
- Update multiple
parameters:
- 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_SERVICEandHEALTHYDataNodes:ozone admin datanode diskbalancer status --in-service-datanodes - Get status in JSON
format:
ozone admin datanode diskbalancer status --in-service-datanodes --json
- Get status from multiple DataNodes:
- 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_SERVICEandHEALTHYDataNodes:ozone admin datanode diskbalancer report --in-service-datanodes - Get report in JSON
format:
ozone admin datanode diskbalancer report --in-service-datanodes --json
- Get report from multiple
DataNodes:
