Soft Stopping and Starting a backend server
Command-line example for soft stopping and starting a backend server in a virtual Load Balancer group or backend. This is useful for maintenance periods, etc. You will be calling the snaptHA.soft_stop method and snaptHA.soft_start methods with the argument array of (BackendName, ServerName). The change takes immediate effect.
The XmlRpc URL for these requests is http://snapt/api/key/secret/snaptHA/
Code Example
$backend = 'WebGroup'; // Group or backend name $server = 'www01'; // Server name in group/backend $api = 'snaptHA'; // Balancer $method = 'soft_stop'; // soft_stop method being called $call = $api . '.' . $method; $args = array($backend, $server); // group or backend and server to pause $result = getClient($api)->call($call, $args); // Send your XMLRPC request
This uses the Zend XmlRpc client, with a custom function getClient as shown below:
function getClient($api) { $client = new Zend_XmlRpc_Client('http://' . SERVER . '/api/' . APIKEY . '/' . APISECRET . '/' . $api . '/'); $client->getHttpClient()->setConfig(array('timeout' => 10)); return $client; }
Please also refer to the developers section of this site for further documentation.