Created
February 15, 2016 08:58
-
-
Save ableasdale/6e9c0aad010d6138f8d8 to your computer and use it in GitHub Desktop.
Reordering forests for the rebalancer after adding more hosts to a cluster.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| xquery version "1.0-ml"; | |
| import module namespace admin = "http://marklogic.com/xdmp/admin" at "/MarkLogic/admin.xqy"; | |
| declare variable $DATABASE as xs:string := "example-db"; | |
| let $config := admin:get-configuration() | |
| let $dbid := admin:database-get-id($config, $DATABASE) | |
| return | |
| admin:save-configuration( | |
| admin:database-reorder-forests($config, $dbid, | |
| (for $i in xdmp:database-forests(xdmp:database($DATABASE)) | |
| let $fname := xdmp:forest-name($i) | |
| order by number(substring-before(substring-after($fname, "n"),"-")) | |
| return ($i)) | |
| ) | |
| ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment