Automatic balancing

Use automatic balancing when turning on the balancer module.

Turn on the capacity balancer, by using the ceph balancer on command. By default, when turning on the balancer module, automatic balancing is used and the upmap mode is enabled.
[ceph: root@host01 /]# ceph balancer on

You can change the balancer mode from upmap to crush-compact mode. The crush-compat mode is backward compatible with older clients and makes small changes to the data distribution to ensure that OSDs are equally utilized.

After the balancer is on, you can verify the balancer status.
[ceph: root@host01 /]# ceph balancer on
[ceph: root@host01 /]# ceph balancer mode crush-compat
[ceph: root@host01 /]# ceph balancer status
{
    "active": true,
    "last_optimize_duration": "0:00:00.001174",
    "last_optimize_started": "Fri Nov 22 11:09:18 2024",
    "mode": "crush-compact",
    "no_optimization_needed": false,
    "optimize_result": "Unable to find further optimization, change balancer mode and retry might help",
    "plans": []
}
To turn off the balancer module, use the ceph balancer off command. For example,
[ceph: root@host01 /]# ceph balancer off
[ceph: root@host01 /]#  ceph balancer status
{
    "active": false,
    "last_optimize_duration": "",
    "last_optimize_started": "",
    "mode": "crush-compat",
    "no_optimization_needed": false,
    "optimize_result": "",
    "plans": []
}