Created
July 5, 2018 13:41
-
-
Save ableasdale/4947986bb6b01e3a6b880c8bfc1dfce2 to your computer and use it in GitHub Desktop.
MarkLogic: Quickly create a group of master and replica forests on a MarkLogic 3-node 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 $dbname := "DATABASE-NAME_HERE"; | |
declare variable $CONFIG := admin:get-configuration(); | |
( | |
(: Create Master Forests - A :) | |
for $j in 1 to 5 | |
let $CONFIG := admin:forest-create($CONFIG, $dbname||"-"||$j, xdmp:hosts()[1], "/space") | |
return admin:save-configuration($CONFIG), | |
(: Create Master Forests - B :) | |
for $j in 6 to 10 | |
let $CONFIG := admin:forest-create($CONFIG, $dbname||"-"||$j, xdmp:hosts()[2], "/space") | |
return admin:save-configuration($CONFIG), | |
(: Create Master Forests - C :) | |
for $j in 11 to 15 | |
let $CONFIG := admin:forest-create($CONFIG, $dbname||"-"||$j, xdmp:hosts()[3], "/space") | |
return admin:save-configuration($CONFIG), | |
(: CREATE REPLICAS - A :) | |
for $j in 1 to 5 | |
let $CONFIG := admin:forest-create($CONFIG, $dbname||"-R-"||$j, xdmp:hosts()[2], "/space") | |
return admin:save-configuration($CONFIG), | |
(: CREATE REPLICAS - B :) | |
for $j in 6 to 10 | |
let $CONFIG := admin:forest-create($CONFIG, $dbname||"-R-"||$j, xdmp:hosts()[3], "/space") | |
return admin:save-configuration($CONFIG), | |
(: CREATE REPLICAS - C :) | |
for $j in 11 to 15 | |
let $CONFIG := admin:forest-create($CONFIG, $dbname||"-R-"||$j, xdmp:hosts()[1], "/space") | |
return admin:save-configuration($CONFIG) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment