Esta é uma API de consulta das informações do cluster failover.
API de busca de informações de um cluster existente.
Exemplo de requisição
GET /api/cluster HTTP/1.1
Host: api.exemplo.com
Accept: application/json
Authorization: Bearer <Access-Token>
response = sdk.cluster.get_cluster()
print(response.payload)
const response = sdk.cluster.getCluster();
console.log(response.payload);
Exemplo de resposta
HTTP/1.1 200 OK
Content-Type: application/json
{
"servers": [
{
"hostname": "pcmk-1",
"conn_status": "up",
"node_status": "active",
},
{
"hostname": "pcmk-2",
"conn_status": "up",
"node_status": "active",
},
{
"hostname": "pcmk-3",
"conn_status": "up",
"node_status": "active",
},
{
"hostname": "pcmk-4",
"conn_status": "down",
"node_status": "inactive",
}
],
"resources": [
{
"name": "WebSite",
"type": "ocf::heartbeat:apache",
"status": "started",
"enabled": "enabled",
"locations": ["pcmk-1"],
},
{
"name": "dummy1-3",
"type": "ocf::heartbeat:Dummy",
"status": "stopped",
"enabled": "disabled",
"locations": [],
},
{
"name": "dummy1-4",
"type": "ocf::heartbeat:Dummy",
"status": "failed",
"enabled": "enabled",
"locations": ["pcmk-2"],
},
],
"virtual_ips": [
{
"name": "ClusterIP",
"status": "started",
"enabled": "enabled",
"addr": "192.168.0.120/24",
"iface": "eth0",
"locations": ["pcmk-2"],
},
{
"name": "ClusterIP2",
"status": "started",
"enabled": "enabled",
"addr": "192.165.10.10/24",
"iface": "eth1",
"locations": ["pcmk-2", "pcmk-3"],
},
],
"last_update": "2018-12-13T12:20:02.932000+00:00",
"last_change": "2018-12-13T12:20:02.932000+00:00",
}
Cluster(
servers=[
Server(
hostname="pcmk-1",
conn_status="up",
node_status="active",
),
Server(
hostname="pcmk-2",
conn_status="up",
node_status="active",
),
Server(
hostname="pcmk-3",
conn_status="up",
node_status="active",
),
Server(
hostname="pcmk-4",
conn_status="down",
node_status="inactive",
),
],
resources=[
Resource(
name="WebSite",
type="ocf::heartbeat:apache",
status="started",
enabled="enabled",
locations=["pcmk-1"],
),
Resource(
name="dummy1-3",
type="ocf::heartbeat:Dummy",
status="stopped",
enabled="disabled",
locations=[],
),
Resource(
name="dummy1-4",
type="ocf::heartbeat:Dummy",
status="failed",
enabled="enabled",
locations=["pcmk-2"],
),
],
virtual_ips=[
VirtualIp(
name="ClusterIP",
status="started",
enabled="enabled",
addr="192.168.0.120/24",
iface="eth0",
locations=["pcmk-2"],
),
VirtualIp(
name="ClusterIP2",
status="started",
enabled="enabled",
addr="192.165.10.10/24",
iface="eth1",
locations=["pcmk-2", "pcmk-3"],
),
],
last_update=DateTime(2018, 12, 13, 12, 20, 2, tzinfo=Timezone('+00:00')),
last_change=DateTime(2018, 12, 13, 12, 20, 2, tzinfo=Timezone('+00:00')),
)
{
servers: [
{
hostname: "pcmk-1",
connStatus: "up",
nodeStatus: "active",
},
{
hostname: "pcmk-2",
connStatus: "up",
nodeStatus: "active",
},
{
hostname: "pcmk-3",
connStatus: "up",
nodeStatus: "active",
},
{
hostname: "pcmk-4",
connStatus: "down",
nodeStatus: "inactive",
}
],
resources: [
{
name: "WebSite",
type: "ocf::heartbeat:apache",
status: "started",
enabled: "enabled",
locations: ["pcmk-1"],
},
{
name: "dummy1-3",
type: "ocf::heartbeat:Dummy",
status: "stopped",
enabled: "disabled",
locations: [],
},
{
name: "dummy1-4",
type: "ocf::heartbeat:Dummy",
status: "failed",
enabled: "enabled",
locations: ["pcmk-2"],
},
],
virtualIps: [
{
name: "ClusterIP",
status: "started",
enabled: "enabled",
addr: "192.168.0.120/24",
iface: "eth0",
locations: ["pcmk-2"],
},
{
name: "ClusterIP2",
status: "started",
enabled: "enabled",
addr: "192.165.10.10/24",
iface: "eth1",
locations: ["pcmk-2", "pcmk-3"],
},
],
lastUpdate: "2018-12-13T12:20:02.000Z",
lastChange: "2018-12-13T12:20:02.000Z",
}
API de sincronização dos nós (servidores) do cluster.
Exemplo de requisição
POST /api/cluster/sync HTTP/1.1
Host: api.exemplo.com
Accept: application/json
Authorization: Bearer <Access-Token>
sdk.cluster.sync()
sdk.cluster.sync();
Exemplo de resposta
HTTP/1.1 200 OK
Content-Type: application/json
API de assumir nó (servidor) do cluster.
Exemplo de requisição
POST /api/cluster/takeover HTTP/1.1
Host: api.exemplo.com
Accept: application/json
Authorization: Bearer <Access-Token>
{
"server_name": "pcmk-2"
}
sdk.cluster.takeover(server_name="pcmk-2")
sdk.cluster.takeover({serverName: "pcmk-2"});
Exemplo de resposta
HTTP/1.1 200 OK
Content-Type: application/json
API para habilitar recurso do cluster.
resource_name
Exemplo de requisição
POST /api/cluster/resource/dummy1-3 HTTP/1.1
Host: api.exemplo.com
Accept: application/json
Authorization: Bearer <Access-Token>
{
"enable": true
}
from itflex_sdk.cluster.types import EnableResourceRequest
request = EnableResourceRequest(
resource_name="dummy1-3",
enable=True
)
response = sdk.cluster.enable_rosource(request)
const response = sdk.cluster.enableResource({ resourceName: "dummy1-3", enable: true });
Exemplo de resposta
HTTP/1.1 200 OK
Content-Type: application/json
API para reiniciar recurso do cluster.
resource_name
/restart
Exemplo de requisição
POST /api/cluster/resource/dummy1-3/restart HTTP/1.1
Host: api.exemplo.com
Accept: application/json
Authorization: Bearer <Access-Token>
from itflex_sdk.cluster.types import RestartResourceRequest
request = RestartResourceRequest(
resource_name="dummy1-3"
)
response = sdk.cluster.restart_rosource(request)
const response = sdk.cluster.restartResource({ resourceName: "dummy1-3" });
Exemplo de resposta
HTTP/1.1 200 OK
Content-Type: application/json
API para habilitar o ip vitual do cluster.
virtual_ip_name
Exemplo de requisição
POST /api/cluster/virtualip/ClusterIP HTTP/1.1
Host: api.exemplo.com
Accept: application/json
Authorization: Bearer <Access-Token>
{
"enable": true
}
from itflex_sdk.cluster.types import EnableVirtualIpRequest
request = EnableVirtualIpRequest(
virtual_ip_name="ClusterIP",
enable=True
)
response = sdk.cluster.enable_virtual_ip(request)
const response = sdk.cluster.enableVirtualIp({ virtualIpName: "ClusterIP", enable: true });
Exemplo de resposta
HTTP/1.1 200 OK
Content-Type: application/json
API para reiniciar ip virtual do cluster.
virtual_ip_name
/restart
Exemplo de requisição
POST /api/cluster/virtualip/ClusterIP/restart HTTP/1.1
Host: api.exemplo.com
Accept: application/json
Authorization: Bearer <Access-Token>
from itflex_sdk.cluster.types import RestartVirtualIpRequest
request = RestartVirtualIpRequest(
virtual_ip_name="ClusterIP"
)
response = sdk.cluster.restart_virtual_ip(request)
const response = sdk.cluster.restartVirtualIp({ virtualIpName: "ClusterIP" });
Exemplo de resposta
HTTP/1.1 200 OK
Content-Type: application/json
Requisição
Campo | Descrição |
---|---|
server_name | string Nome do servidor (nó) que compõe o Cluster. |
resource_name | string Nome do recurso do cluster. |
enable | bool Flag que determina se o recurso do cluster está habilitado ou desabilitado. |
virtual_ip_name | string Nome do ip virtual do cluster. |
Resposta
Campo | Descrição |
---|---|
servers | Array<Server> Lista de servidores gerenciados pelo cluster. |
servers[].hostname | string Hostname da máquina. |
servers[].conn_status | string Status da comunicação da máquina no cluster. Valores possíveis:
|
servers[].node_status | string Status da máquina no cluster. Valores possíveis:
|
resources | Array<Resource> Lista de recursos gerenciados pelo cluster. |
resources[].name | string Nome do recurso do cluster. |
resources[].type | string Tipo do recurso do cluster. |
resources[].status | string Status do recurso no cluster. Valores possíveis:
|
resources[].enabled | string Status de habilitado/desabilitado do recurso no cluster. Valores possíveis:
|
resources[].locations | Array<string> Nome das máquinas onde o recurso está alocado/aplicado/em execução. |
virtual_ips | Array<VirtualIp> Lista de IPs virtuais gerenciados pelo cluster. |
virtual_ips[].name | string Nome do recurso de IP do cluster. |
virtual_ips[].status | string Status do recurso de IP no cluster. Valores possíveis:
|
virtual_ips[].enabled | string Status de habilitado/desabilitado do recurso de IP no cluster. Valores possíveis:
|
virtual_ips[].addr | string Endereço de IP/máscara do recurso. Ex.: |
virtual_ips[].iface | string Interface de rede que o endereço está associado. |
virtual_ips[].locations | Array<string> Nome das máquinas onde o recurso de IP está alocado/aplicado/em execução. |
last_update | string Data da última alteração realizada pelo serviço.
|
last_change | string Data da última alteração de configuração do cluster.
|