Loading TOC...

GET /admin/v1/server-config

Summary

Retrieve MarkLogic Server configuration information, suitable for use in joining a cluster.

Response Headers
Content-type The MIME type of the data in the response body. The response MIME type is always application/xml.

Response

Upon success, MarkLogic Server returns status code 200 (OK) and the response body contains the requested information, expressed as XML.

If license key installation and basic initialization have not yet been done, the response payload will include a timestamp, but all other elements will be empty.

Required Privileges

If security has not yet been installed, no authentication is required. If security has been installed, digest authentication is required, but no privilege checking is done.

Usage Notes

This request must be directed to the MarkLogic Server Admin Interface on port 8001. For example: http://localhost:8001/admin/v1/server-config.

This method is intended for use in the context of other REST Management API methods during cluster configuration, such as using the data returned by this request as input to a POST request to /admin/v1/cluster-config. For the expected sequence, see the examples below.

For details and a complete example, see Scripting Cluster Management in the Scripting Administrative Tasks Guide.

Example


$ curl --anyauth --user user:password -X GET -H "Accept: application/xml" \
    http://my-host:8001/admin/v1/server-config

==> The configuration of the server my-host.marklogic.com. MarkLogic
    Server responds with output similar to the following. (The security
    certificate has been elided for brevity.) See the additional example
    for the full join sequence.

HTTP/1.1 200 OK
Content-type: application/xml
Server: MarkLogic
Content-Length: 1487
Connection: Keep-Alive
Keep-Alive: timeout=5

<host xmlns="http://marklogic.com/manage">
  <timestamp>2013-06-18T08:11:29.188561-07:00</timestamp>
  <version>7.0</version>
  <platform>linux</platform>
  <edition>Essential Enterprise</edition>
  <host-id>4808503609057420751</host-id>
  <host-name>my-host.marklogic.com</host-name>
  <bind-port>7999</bind-port>
  <connect-port>7999</connect-port>
  <foreign-bind-port>7998</foreign-bind-port>
  <foreign-connect-port>7998</foreign-connect-port>
  <ssl-certificate>...elided...</ssl-certificate>
</host>
  

Example


Use in the following sequence to add a host to a cluster, assuming
clusterhost is a previously fully initialized bootstrap host for
the cluster and joining-host is the host to be initialized and added to
the cluster:

(1) Initialize the new host. For details, see POST /admin/v1/init.
    Use GET /admin/v1/timestamp to verify a successful restart.
    For details, see POST /admin/v1/init.

    $ curl -X POST -d "" http://joining-host:8001/admin/v1/init
    $ curl -X GET http://joining-host:8001/admin/v1/timestamp

(2) Retrieve the configuration of the joining host, to be used as the
    value of the server-config param to POST /admin/v1/cluster-config.

    $ curl -o joiner-config.xml -X GET -H "Accept: application/xml" \
        http://joining-host:8001/admin/v1/server-config

    ==> The configuration for joining-host is saved to joiner-config.xml.
        See the previous example for the output details.

(3) Send the joining host's URL encoded config info to the cluster host.
    Receive the cluster configuration in return. For details, see
    POST /admin/v1/cluster-config.

    $ curl --anyauth --user user:password -X POST -d "group=Default" \
        --data-urlencode "server-config@./joiner-config.xml" \
        -H "Content-type: application/x-www-form-urlencoded" \
        -o cluster-config.zip http://clusterhost:8001/admin/v1/cluster-config

    ==> The cluster configuration data is saved in cluster-config.zip.

(4) Send the cluster configuration ZIP file to the joining host to 
    complete the cluster join sequence. Bracket the POST with calls 
    to GET /admin/v1/timestamp to confirm a successful restart. For
    details, see POST /admin/v1/cluster-config.

    $ curl -X GET http://joining-host:8001/admin/v1/timestamp
    $ curl -X POST -H "Content-type: application/zip" \
        --data-binary @./cluster-config.zip \
        http://joining-host:8001/admin/v1/cluster-config
    $ curl --anyauth --user user:password -X GET \
        http://joining-host:8001/admin/v1/timestamp

    ==> The joining host becomes a functional member of the cluster.
  

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.