Loading TOC...

POST /manage/v2/clusters/{id|name}

Summary

Initiate a state change on the named cluster, such as a shutdown or restart.

URL Parameters
state The type of state change to initiate. Allowed values: shutdown, restart. Specify this parameter as form data in the POST body.
format The format of the returned data. Can be either 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. Supported values: application/xml, application/json.
Content-type The MIME type of the data in the request body. The only supported value is application/x-www-form-urlencoded.
Response Headers
Content-type The MIME type of the data in the response body. Use the Accept header or format request parameter to specify a preferred format. The format parameter takes precedence over the Accept header if both are present.

Response

MarkLogic Server returns status code 202 (Accepted). The response body includes a list of restarted hosts and their last start times.

Required Privileges

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

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

Usage Notes

The POST body must contain the state parameter, as HTML form data. For example: state=restart.

You cannot initiate a state change on a foreign cluster.

You can address the local cluster at /manage/v2, without specifying the full /manage/v2/clusters/{id|name}.

Example


$ curl --anyauth --user user:password -X POST --data "state=shutdown" \
   http://localhost:8002/manage/v2/clusters/123409234245

==> Initiate a shutdown of the local cluster using the cluster id.
    MarkLogic responds with output similar to the following. This output
    represents a 2-host cluster.
Content-type: application/xml
Server: MarkLogic
Content-Length: 160
Connection: Keep-Alive
Keep-Alive: timeout=5

HTTP/1.1 202 Accepted
Content-type: application/xml
Cache-Control: no-cache
Expires: -1
Server: MarkLogic
Content-Length: 313
Connection: Keep-Alive
Keep-Alive: timeout=5

<shutdown xmlns="http://marklogic.com/manage">
  <last-startup host-id="13544732455686476949">
    2013-09-21T09:45:07.936648-07:00</last-startup>
  <last-startup host-id="11346873982344721834">
    2013-09-21T09:45:07.57723-07:00
  </last-startup>
  <message>Shutdown of cluster (17224434944267874968) initiated.</message>
</shutdown>

The following is the equivalent JSON output:

{ "shutdown": {
    "last-startup": [
      {
        "host-id": "13544732455686476949",
        "value": "2013-09-21T09:55:40.567285-07:00"
      },
      {
        "host-id": "11346873982344721834",
        "value": "2013-09-21T09:55:40.567285-07:00"
      }
    ],
    "link": {
      "kindref": "timestamp",
      "uriref": "/admin/v1/timestamp"
    },
    "message": "Check for new timestamp to verify host restart."
} }
    

Example


$ curl --anyauth --user user:password -i -X POST --data "state=restart" \
   http://localhost:8002/manage/v2

==> Initiate a restart of the local cluster, using the /manage/v2 shorthand.
    Use the returned restart information and the timestamp service to
    determine when the restart is complete. The output below represents a
    2-host cluster.

Content-type: application/xml
Server: MarkLogic
Content-Length: 160
Connection: Keep-Alive
Keep-Alive: timeout=5

HTTP/1.1 202 Accepted
Content-type: application/xml
Cache-Control: no-cache
Expires: -1
Location: /admin/v1/timestamp
Server: MarkLogic
Content-Length: 383
Connection: Keep-Alive
Keep-Alive: timeout=5

<restart xmlns="http://marklogic.com/manage">
  <last-startup host-id="13544732455686476949">
    2013-09-21T09:44:49.498658-07:00
  </last-startup>
  <last-startup host-id="11346873982344721834">
    2013-09-21T09:44:49.434052-07:00
  </last-startup>
  <link>
    <kindref>timestamp</kindref>
    <uriref>/admin/v1/timestamp</uriref>
  </link>
  <message>Check for new timestamp to verify host restart.</message>
</restart>

The following is the equivalent JSON output:

{ "restart": {
    "last-startup": [
      {
        "host-id": "13544732455686476949",
        "value": "2013-09-21T09:55:40.567285-07:00"
      },
      {
        "host-id": "11346873982344721834",
        "value": "2013-09-21T09:55:40.567285-07:00"
      }
    ],
    "link": {
      "kindref": "timestamp",
      "uriref": "/admin/v1/timestamp"
    },
    "message": "Check for new timestamp to verify host restart."
} }
    

Example


$ curl --anyauth --user user:password -X POST -i --data "state=restart" \
   -H "Accept: application/json" http://localhost:8002/manage/v2

==> Initiate a restart of the local cluster, using the /manage/v2 shorthand.
    Output is returned as JSON, due to the Accept header. The output below
    represents a 2-host cluster.

<apidoc:function name="/manage/v2/servers/{id|name}" http-verb="DELETE"
       	lib="manage" category="Management API" bucket="REST Resources API"
       	subcategory="App Servers">
  <apidoc:summary> 
  This resource address deletes the specified App Server from the specified group.
  </apidoc:summary>
  <apidoc:params>
    <apidoc:param name="group-id" type="string">
     The id or name of the group to which the App Server belongs. This
     parameter is required.
    </apidoc:param>	  
    <apidoc:param name="format" type="string">
     The format of the posted data.  Can be either 
     <code>html</code>, <code>json</code>, or <code>xml</code> (default). This value overrides the
     Accept header if both are present.
    </apidoc:param>  
  </apidoc:params>
  <apidoc:headers>
    <apidoc:header name="Accept" type="request">
      The expected MIME type of the request body. If the <code>format?</code>
      parameter is present, it takes precedence over the Accept header.
    </apidoc:header>   
  </apidoc:headers>
  <apidoc:response>
    Upon success, MarkLogic Server returns a status code 202 (Accepted) if
    the request causes a restart, or status code 204 (No Content)
    if the request does not cause a restart. When 202 is returned, the standard 
    <code>restart</code> payload body is also returned.
     If the payload is malformed or the group doesn't exist, 
     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.
  </apidoc:response>
  <apidoc:privilege>
    This operation requires the <code>manage-admin</code> role, or the 
    following privilege:
    <p><code>http://marklogic.com/xdmp/privileges/manage-admin</code></p>
  </apidoc:privilege>
  <apidoc:example><pre xml:space="preserve"><![CDATA[
curl -X DELETE --anyauth -u $admin:$admin -H "Accept: application/json" \
http://localhost:8002/manage/v2/servers/myServer?group-id=Default&format=json

==>  Deletes the HTTP App Server, named "myServer," from the Default group. 
    

Comments

    Powered by MarkLogic Server 7.0-4.1 and rundmc | Terms of Use | Privacy Policy