Last active
February 24, 2016 15:16
-
-
Save ableasdale/5900c46e6408786e5cb4 to your computer and use it in GitHub Desktop.
MarkLogic: ReST API - Create a forest with a replica on another host
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"; | |
(: | |
1) setup a cluster with a couple of hosts (127.0.0.1, 127.0.0.2) | |
2) create forest (replicatest) on host 127.0.0.2 | |
3) create forest (test) on host 127.0.0.1 | |
:) | |
declare variable $payload-status := '{ | |
"forest-name":"test", | |
"host":"' || xdmp:hostname() || '", | |
"data-directory":"/tmp", | |
"forest-replica":[ | |
{"replica-name":"replicatest","host":"127.0.0.2"} | |
] | |
}'; | |
xdmp:http-post("http://localhost:8002/manage/v2/forests?format=json", | |
<options xmlns="xdmp:http"> | |
<authentication method="digest"> | |
<username>user</username> | |
<password>pass</password> | |
</authentication> | |
<data>{$payload-status}</data> | |
<headers> | |
<content-type>application/json</content-type> | |
<accept>application/json</accept> | |
</headers> | |
</options>) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment