Loading TOC...

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

Summary

Initiate a state change on a host, such as a shutdown or restart.

URL Parameters
state The type of state change to initiate. Allowed values: shutdown, restart. This parameter must be specified as form data in the POST body.
format The format of the posted data. Can be either json, or xml (default). This value overrides the Accept header if both are present.
failover Enable fast failover. Set to true to enable fast failover, or false (default) to disable.
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. Depending upon the value of the format parameter or Accept header, one of application/xml, application/json.
Location If the requested operation causes a restart, a reference to the timestamp service is returned in the Location header. Use this reference to test for successful completion of the restart.

Response

MarkLogic Server returns status code 202 (Accepted). The response body includes the last start time. If the operation is asynchronous, a reference to the timestamp service is included in the Location header and the response data. Use it to confirm successful completion.

Required Privileges

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

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

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

Usage Notes

The data in the request body is shown below.

Restart is an asynchronous operation. You can use the timestamp reference returned in the Location header and the response body to test for successful completion of the restart. For details, see GET /admin/v1/timestamp.

dynamic-host

host-name

The internet host name.

group

A group name or id.

bind-port

The distributed protocol server socket bind internet port number.

foreign-bind-port

The distributed protocol foreign server socket bind internet port number.

zone

Zone the host belongs to.

bootstrap-host

host-mode

The mode of this host

host-mode-description

The description for this host mode

Example


$ curl --anyauth --user password:password -X POST -i --data "state=restart" \
    -H "Content-type: application/x-www-form-urlencoded" \
    http://localhost:8002/manage/v2/hosts/my-host

==> MarkLogic Server is restarted on the host my-host. MarkLogic Server
    returns output similar to the following. Use the timestamp reference 
    in the Location header or the response body to check on the status.

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

<restart xmlns="http://marklogic.com/manage">
  <last-startup host-id="13544732455686476949">
    2013-09-21T09:55:40.929792-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 response data:

{ "restart": {
  "last-startup": {
    "host-id":"13544732455686476949", 
    "value":"2013-09-23T09:16:32.897234-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=shutdown" \
    -H "Content-type: application/x-www-form-urlencoded" \
    http://localhost:8002/manage/v2/hosts/my-host?format=JSON

==> MarkLogic Server is shut down on the host my-host. MarkLogic Server
    returns output similar to the following. 

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

{ "shutdown": {
  "last-startup":"2013-09-23T09:10:22.375938-07:00", 
  "message":"Shutdown of host my-host (13544732455686476949) initiated."
}}
    

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