This resource address creates a foreign cluster. For an example, see Coupling the Master and Replica Clusters in the Scripting Administrative Tasks Guide.
URL Parameters | |
---|---|
format | The format of the posted data. Can be either
html , json , or xml (default). This value overrides
the Accept header if both are present. |
Upon success, MarkLogic Server returns status code 200 (OK). If the payload is malformed, a status code of 400 (Bad Request) is returned. A status code of 401 (Unauthorized) is returned if the user does not have the necessary privileges.
manage-admin
role, or the following
privilege: http://marklogic.com/xdmp/privileges/manage
http://marklogic.com/xdmp/privileges/manage-admin
If a foreign cluster was previously added, an attempt to recouple will be invoked and the following applies:
foreign-cluster-id
and foreign-host-id
are required as they
are foreign identifiers.foreign-protocol
is either http
or https
."ALL:!LOW:@STRENGTH"
is set when
xdqp-ssl-cipher
is undefined. Note: The properties described here are for XML payloads. In general they are the same
for JSON, with the exception that, in JSON, foreign-bootstrap-hosts
is
expressed in singular form. For example, in JSON, foreign-bootstrap-hosts
is
instead foreign-bootstrap-host
and the format is as shown in the example below.
foreign-cluster-id
foreign-cluster-name
xdqp-timeout
host-timeout
foreign-ssl-certificate
xdqp-ssl-enabled
xdqp-ssl-allow-sslv3
xdqp-ssl-allow-tls
xdqp-ssl-ciphers
foreign-bootstrap-hosts
This is a complex structure with the following children:
foreign-bootstrap-host
This is a complex structure with the following children:
foreign-host-id
foreign-host-name
foreign-connect-port
foreign-protocol
#! /bin/bash # simple way to couple clusters # you can add manageadmin user with manage-admin role with ./init.sh MANAGEADMIN="admin" MANAGEPASS="admin" # get properties from clusters CLUSTER1_PROPERTIES=`curl -X GET --anyauth --user $MANAGEADMIN:$MANAGEPASS \ --header "Content-Type:application/json" http://localhost:8002/manage/v2/properties?format=json` CLUSTER2_PROPERTIES=`curl -X GET --anyauth --user $MANAGEADMIN:$MANAGEPASS \ --header "Content-Type:application/json" http://127.0.0.2:8002/manage/v2/properties?format=json` # apply couple cluster operation on both clusters curl -X POST --anyauth --user $MANAGEADMIN:$MANAGEPASS \ --header "Content-Type:application/json" -d"$CLUSTER2_PROPERTIES" \ http://localhost:8002/manage/v2/clusters?format=json curl -X POST --anyauth --user $MANAGEADMIN:$MANAGEPASS \ --header "Content-Type:application/json" -d"$CLUSTER1_PROPERTIES" \ http://127.0.0.2:8002/manage/v2/clusters?format=json ==> Couples the "localhost" cluster to the "127.0.0.2" cluster.
cat newCluster.json ==> { "foreign-cluster-id": "12321312312312", "foreign-cluster-name": "127.0.0.2-cluster", "foreign-protocol": "http", "foreign-ssl-certificate": "", "xdqp-ssl-enabled": true, "xdqp-ssl-allow-sslv3": true, "xdqp-ssl-allow-tls": true, "xdqp-ssl-ciphers": "ALL:!LOW:@STRENGTH", "xdqp-timeout": 10, "host-timeout": 30, "foreign-bootstrap-host": [ { "foreign-host-id": "123123123123", "foreign-host-name": "127.0.0.2", "foreign-connect-port": 7998 }, { "foreign-host-id": "123123123123", "foreign-host-name": "otherhost", "foreign-connect-port": 7998 } ] } curl -X POST --anyauth -u admin:admin --header "Content-Type:application/json" \ -d @newCluster.json http://localhost:8002/manage/v2/clusters ==> Creates a foreign cluster, named "127.0.0.2-cluster."
Stack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.