The serverAddToCluster Web API Method

Join the current server to a cluster. If the cluster database is not set up, the server will attempt to create the database and then perform the join using the provided credentials. If possible, a user “zend” will be created and used to perform the connection.

Version: 1.3

Required Permissions: Full

HTTP method: POST

Request Parameters:

Parameter

 Type

Required

Description

serverName

String

Yes

Server name

dbHost

String

Yes

Database host address to join the cluster

dbUsername

String

Yes

Database credentials (username)

dbPassword

String

Yes

Database credentials (password)

nodeIp

String

Yes

Server IP

dbName

String

Yes

Database name

failIfConnected

Boolean

No

Cause the action to completely fail if the server is already connected. Otherwise, a normal 200 status is returned without performing any action. Default: false

Expected Response Code: 202 Accepted

Response Type: serverInfo with information about the added server

Possible Action Specific Error Codes:

HTTP Code

 Error Code

Description

400

alreadyConnected

The server is already a member of a cluster (not necessarily the current cluster)

400

wrongPassword

Provided GUI password is incorrect

405

notImplementedByEdition

This method is only available on Professional or Enterprise editions

500

invalidServerResponse

Invalid or unexpected response from new server

500

serverNotLicensed

Zend Server is not licensed

500

noActiveServers

The server cannot be added because all servers in the cluster are disabled or unreachable

500

cantConnectToServer

Zend Server is unable to connect to the specified Server URL

503

temporarilyLocked

The server cannot be added because a cluster member is in graceful startup / shutdown mode

Example

Usage Example

Request (URI broken for readability)

POST /ZendServer/Api/clusterAddServer

serverName=www-05&serverURL=https://www-05.local:10081/ZendServer&

guiPassword=somepassword&doRestart=TRUE

Response

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

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

<requestData>

<apiKeyName>angel.eyes</apiKeyName>

<method>serverAddToCluster</method>

</requestData>

<responseData>

<serverInfo>

<id>25</id>

<name>ubuntu1204-b</name>

<address>10.9.183.84</address>

<status>restarting</status>

<messageList />

<debugModeEnabled>true</debugModeEnabled>

</serverInfo>

<newCredentials>

<new>Yes</new>

</newCredentials>

<clusterAdminKey>

<id>2</id>

<username>admin</username>

<name><![CDATA[QAWebAPITestKey]]></name>

<hash><![CDATA[...]]></hash>

<creationTime>2010-12-15T17:59:12+02:00</creationTime>

</clusterAdminKey>

</responseData>

</zendServerAPIResponse>