Web API Reference Guide > Available API Methods > Server and Cluster Management Methods > The restartDaemon Method

The restartDaemon Method

Restart a Zend Server daemon on all servers or on specified servers in the cluster. A 202 response in this case does not always indicate a successful restart of all servers, and the user is advised to check the server(s) status again after a few seconds using the clusterGetServerStatus command.

Version: 1.3

Required Permissions: Full

HTTP method: POST

Supported by Editions: All

Request Parameters:

Parameter

 Type

Required

Description

daemon

String

Yes

One of the following values: jqd, monitor_node, scd, zdd

servers

Array

No

A list of server IDs to restart. If not specified, all servers in the cluster will be restarted. In a single Zend Server context this parameter is ignored.

Expected Response Code: 202 Accepted. For more information see Response Format.

Response Type: serversList with the status of all servers to which the restart command was requested (i.e. the servers provided in the servers parameter or all servers if no servers are specified).

Possible Action Specific Error Codes:

HTTP Code

 Error Code

Description

404

noSuchServer

One or more of the provided server IDs does not exist. In this case, no servers are restarted.

500

restartFailed

Restarting at least some of the servers failed. This response is only possible when working with a cluster.

Example

Usage Example

Request (headers removed for clarity)

POST /ZendServer/Api/restartDaemon

daemon=jqd&servers%5B0%5D=1&servers%5B1%5D=2

Response

HTTP/1.0 200 OK

<?xml version="1.0" encoding="UTF-8"?>

<zendServerAPIResponse xmlns="http://www.zend.com/server/api/1.3">

<requestData>

<apiKeyName>angel.eyes</apiKeyName>

<method>restartDaemon</method>

</requestData>

<responseData>

<serversList>

<serverInfo>

<id>1</id>

<name>www-01</name>

<address>https://www-01.local:10082/ZendServer</address>

<status>restarting</status>

<messageList />

<debugModeEnabled>true</debugModeEnabled>

</serverInfo>

<serverInfo>

<id>2</id>

<name>www-02</name>

<address>https://www-02.local:10082/ZendServer</address>

<passwordSet>restarting</passwordSet>

<messageList />

<debugModeEnabled>true</debugModeEnabled>

</serverInfo>

</serversList>

</responseData>

</zendServerAPIResponse>

Important Note:

For Zend Server on Mac or Linux, this action is also available via the command line using CLI Tools. For more information see CLI Tools.

 

Read Also

  Available API Methods    
  Server and Cluster Management Methods