Skip to main content

Join cluster

To join to cluster, you need to log in.

Request Structure:

http://<cluster>:<port>/api/claster/join

Post data:

access_token = <access_token>
cluster_username = <username>
cluster_password = <password>
cluster_ip = <IP>

The response from the server:

{
 "msg": <cluster config>,
 "status": "success",
 "error": ""
}

Errors:

-cluster not created on connecting node
-missing data
-username not found
-password is wrong
-a node with the same hostname is already in the cluster

Example:

import requests
import json

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

path = 'cluster/join'
data = {
    'cluster_username': 'admin',
    'cluster_password': 'admin',
    'cluster_ip': '192.168.129.81',
}


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

send(path, data)