Virtualizor support Central Management of many Nodes / Servers so that you can access and create VPS from the Master server only. You can slave an existing Virtualizor Server and deslave it any time. The master interacts with the slave only when necessary. The slave just becomes a extra resource for the master. The Virtualization Type will be detected by the Master itself. Also the MASTER can be OF ANY VIRTUALIZATION type i.e. OpenVZ, Xen or Linux KVM. The Add Server API allows you to add slave server to the master server. The API response will return "saved" as "true" after the server is successfully added.
The Slave server must have Virtualizor installed.
For more information, please refer this Server Clustering guide.
HTTP Request
https://hostname:4085/index.php?act=addserver
Parameters
Name | Method | Value | Description | Required |
---|---|---|---|---|
act | GET | addserver | The action to add the server to a cluster | Yes |
server_name | POST | text | The server name that will be given while adding | Yes |
ip | POST | text | IP address of the server to be added | Yes |
pass | POST | text | The API password of the server | Yes |
sgid | POST | Int | The server group to which the server will be added | Yes |
locked | POST | 1/0 | The flag value to decide whether the server will be locked or not | No |
internal_ip | POST | text | The internal ip will be assigned to the server | No |
Sample Code
<?php
require_once('/usr/local/virtualizor/sdk/admin.php');
$key = 'your_api_key';
$pass = 'your_api_pass';
$ip = 'your_server_ip';
$admin = new Virtualizor_Admin_API($ip, $key, $pass);
$post = array();
$post['server_name'] = 'Slave_server';
$post['ip'] = 'slave_ip';
$post['pass'] = 'slave_api_pass';
$post['sgid'] = 0;
$output = $admin->addserver($post);
print_r(json_encode($output));
?>
Output
{
"title": "Add Server",
"saved": 6, //Server ID
"servergroups": {
"0": {
"sgid": "0",
"sg_name": "sg_test",
"sg_reseller_name": "sg_region",
"sg_desc": "This is just desc",
"sg_select": "0"
},
"15": {
"sgid": "15",
"sg_name": "testlocal",
"sg_reseller_name": "Local_test",
"sg_desc": "",
"sg_select": "0"
}
},
"timenow": "1474850356",
"time_taken": "1.827"
}