MarkLogic 10 and Data Hub 5.0

Latest MarkLogic releases provide a smarter, simpler, and more secure way to integrate data.

Read Blog →


Stay On Top Of Everything MarkLogic

Be the first to know! News, product information, and events delivered straight to your inbox.

Sign Me Up →

Understanding what work the rebalancer will do
14 December 2020 04:55 AM


Here we will describe how to see in detail the effect of running the rebalancer, before it is enabled.

Admin UI

The Admin UI lets you check the state of the rebalancer, along with an estimated completion time if running, on the Database Status page. See Checking the Rebalancer Status.

Previewing the rebalancer


For a more detailed look at the rebalancing, including how fragments will move between the forests, call xdmp:forest-counts with the 'preview-rebalancer' option.

For example, to get all the values for the forests in the Documents database, running

 xdmp:database-forests (xdmp:database ('Documents')) ! xdmp:forest-counts (., (), ('preview-rebalancer'))

will return a <forest-counts xmlns=""> element for each forest, including information on how many fragments will be moved and their destinations.

HTML table output

The XQuery code below can be run in the query console to output an HTML table with the rebalancing stats from xdmp:forest-counts. Just change the value of $DATABASE from 'Documents' to the name of the database you wish to check:


In database replication with the bucket and legacy policies, the replica-cluster forest order should match the master-cluster forest order, to avoid rebalancing if/when replication is broken. See Database Replication and Rebalancing, replication and forest reordering.

The above technique can be used to check if the replica database will rebalance after replication is broken.

This check can also be used after administrative work on forests to see if there is any resultant rebalancing.


 rebalance.xquery (3.84 KB)
(0 vote(s))
Not helpful

Comments (0)