POST /manage/v2/clusters

Summary

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.
Request Headers
Accept The expected MIME type of the request body. If the format? parameter is present, it takes precedence over the Accept header.
Content-type The MIME type of the data in the request body. Depending upon the value of the format parameter or Accept header, one of application/xml, application/json, or text/html.
Response Headers
Content-type The MIME type of the data in the response body. Depending upon the value of the format parameter or Accept header, one of application/xml, application/json, or text/html.
Location If the request causes a restart, a Location header is included in the reponse. The header contains a path with which to construct a URL to usable to test when the restart has completed.

Response

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.

Required Privileges

This operation requires the manage-admin role, or the following privilege:

http://marklogic.com/xdmp/privileges/manage

http://marklogic.com/xdmp/privileges/manage-admin

Usage Notes

The structure of the data in the request body is as follows.

If a foreign cluster was previously added, an attempt to recouple will be invoked and the following applies:

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

The ID of the foreign cluster.

foreign-cluster-name

The name of the foreign cluster.

xdqp-timeout

The XDQP protocol timeout, in seconds.

host-timeout

The host response timeout, in seconds.

foreign-ssl-certificate

The SSL certificate for the foreign cluster.

xdqp-ssl-enabled

Whether or not SSL is enabled for XDQP.

xdqp-ssl-allow-sslv3

Whether or not SSLv3 is allowed for XDQP.

xdqp-ssl-allow-tls

Whether or not TLS is allowed for XDQP.

xdqp-ssl-ciphers

A colon separated list of ciphers (e.g. ALL:!LOW:@STRENGTH)

foreign-bootstrap-hosts

Information about foreign hosts.

This is a complex structure with the following children:

foreign-bootstrap-host

Information related to a particular foreign host.

This is a complex structure with the following children:

foreign-host-id

The ID of the foreign host.

foreign-host-name

The name of the foreign host.

foreign-connect-port

The distributed protocol client socket connect internet port number.

foreign-protocol

foreign protocol.

Example


   #! /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. 
    

Example


  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."  
    
Powered by MarkLogic Server | Terms of Use | Privacy Policy