quorum

Quorum status

Request Structure:

http://<cluster>:<port>/api/quorum/status

Post data:

access_token = <access_token>

The response from the server:

{
 "msg": {
   "status": "OK",
   "error": "",
   "master": "node-2.docluster.com",
   "nodes": [
    {
     "node": "node-2.docluster.com",
     "status": "online",
     "error": "",
     "config_version": 8
    },
    {
     "node": "node-3.docluster.com",
     "status": "online",
     "error": "",
     "config_version": 8
    },
    {
     "node": "node-4.docluster.com",
     "status": "online",
     "error": "",
     "config_version": 8
    }
   ]
 },
 "status": "success",
 "error": ""
}

Errors:

-<X> MNG nodes are not online

Example:

import requests
import json

api_url = "http://<IP>:<PORT>/api/"
access_token = 'BLABLALBA'

path = 'quorum/status'
data = {}

def send(path, data):
    data['access_token'] = access_token
    send = requests.post(url=api_url + path, data=data)
    print(send.text)
    
send(path, data)

 

Quorum nodes

To add or remove cluster nodes to the quorum.

add node

Request Structure:

http://<cluster>:<port>/api/quorum/add

Post data:

access_token = <access_token>
node = <node-name>

The response from the server:

{
 "msg": {},
 "status": "success",
 "error": ""
}

Errors:

-node already in quorum
-node is not in cluster

Example:

import requests
import json

api_url = "http://<IP>:<PORT>/api/"
access_token = 'BLABLALBA'

path = 'quorum/nodes/add'
data = {}

def send(path, data):
    data['access_token'] = access_token
    send = requests.post(url=api_url + path, data=data)
    print(send.text)
    
send(path, data)

 

delete node

Request Structure:

http://<cluster>:<port>/api/quorum/delete

Post data:

access_token = <access_token>
node = <node-name>

The response from the server:

{
 "msg": {},
 "status": "success",
 "error": ""
}

Errors:

-can not delete master node
-node is not in cluster
-node is not in quorum

Example:

import requests
import json

api_url = "http://<IP>:<PORT>/api/"
access_token = 'BLABLALBA'

path = 'quorum/nodes/delete'
data = {}

def send(path, data):
    data['access_token'] = access_token
    send = requests.post(url=api_url + path, data=data)
    print(send.text)
    
send(path, data)