qluster rest api API Description

Version: 0.1.0

Endpoints

/is-leader

Method: GET Description: returns 200 if this node is the cluster leader Responses:

  • 200 — this node is the cluster leader
  • 412
  • 417
  • 500
  • 530
  • 531

/map

Method: GET Description: returns the cluster map and settings Responses:

  • 200 — ok
  • 412
  • 500
  • 531

/info

Method: GET Description: returns the cluster information needed to start a previously added node Responses:

  • 200 — ok
  • 412
  • 500
  • 531

/config

Method: GET Description: get cluster configuration Responses:

  • 200 — ok
  • 412
  • 500
  • 531Method: POST Description: update cluster configuration
  • Content type: application/json
    • Schema: object Responses:
  • 200 — ok
  • 410
  • 412
  • 417
  • 420
  • 500
  • 530
  • 531

/db-config

Method: GET Description: get database configuration Responses:

  • 200 — ok
  • 412
  • 500
  • 531

/leader

Method: GET Description: get leader addresses Responses:

  • 200 — ok
  • 412
  • 500
  • 530
  • 531Method: POST Description: change leader Parameters:
  • node (query, mandatory) — new leader ID Responses:
  • 200 — ok
  • 412
  • 500
  • 530
  • 531

/node

Method: POST Description: add a new node to the cluster (all new nodes initially become listeners) Parameters:

  • ip (query, mandatory) — IP address of the listener node
  • role (query, mandatory) — node role Responses:
  • 200 — ok
  • 410
  • 412
  • 417
  • 420
  • 500
  • 530
  • 531

/node/{node}

Method: PATCH Description: Upgrade the listener to a proper node Parameters:

  • node (path, mandatory) — node ID
  • db-port (query, mandatory) — database port
  • api-port (query, mandatory) — rest api port Responses:
  • 200 — ok
  • 410
  • 412
  • 417
  • 420
  • 500
  • 530
  • 531Method: DELETE Description: remove a node from a cluster Parameters:
  • node (path, mandatory) — node ID Responses:
  • 200 — ok
  • 410
  • 412
  • 417
  • 420
  • 500
  • 530
  • 531

/node-down/{node}

Method: POST Description: qhb has problems, now it can't participate in votings and be a replica of qcp Parameters:

  • node (path, mandatory) — node ID Responses:
  • 200 — ok
  • 410
  • 412
  • 417
  • 420
  • 500
  • 530
  • 531

/sql/readonly

Method: GET Description: get hashes of queries that don't write anything to the database Responses:

  • 200 — ok
  • 412
  • 500
  • 531

/rpc

Method: GET Description: human-readable cluster and rpc events Responses:

  • 200 — ok
  • 500

/events

Method: GET Description: cluster events Responses:

  • 200 — ok
  • 500


Components

Schemas

NodeId

node ID

  • Type: integer

Term

logical cluster time

  • Type: integer

LogIndex

lsn of the cluster logs

  • Type: integer

Port

  • Type: integer

Duration

time interval in human-readable format

  • Type: string

Config

cluster settings

  • Type: object Fields:
  • node-timeout (object): If within this time the node does not find a leader, it initiates a pre-election
  • pre-voting-timeout (object): During this time, the pre-voting must be completed
  • leader-voting-timeout (object): If within this time the voting does not produce a leader, then the transition to the pre-voting stage occurs
  • heartbeat-interval (object): Frequency with which the leader should send a heartbeat
  • replication-factor (integer): the number of nodes to which a log is replicated before it can be committed (0 - weak replication, enough for the log to end up on the leader)
  • quorum-replication (boolean): if enabled, the value n/2 + 1 is inserted into replication_factor
  • replication-retry-interval (object): the time interval after which the log should be replicated again if no response has been received
  • autoremove-enabled (boolean): if enabled, the leader will remove nodes from the cluster that are not visible to half of the cluster
  • autoremove-minimum (integer): for autoremove to work, the number of cluster nodes must be greater than this value.

NodeRole

  • Type: string

Node

cluster node information

  • Type: object Fields:
  • id (object): node ID
  • ip (string): IPv4/IPv6 host address
  • db-port (object): port on which postgres is running
  • api-port (object): port on which rest api is running
  • role (object): node role in the cluster

ClusterMap

cluster map

  • Type: object Fields:
  • leader (object): cluster leader
  • nodes (object): all cluster nodes

ClusterLog

  • Type: object Fields:
  • index (object): log lsn
  • term (object): logical cluster time
  • payload (object):

ClusterInfo

  • Type: object Fields:
  • term (object): logical cluster time
  • applied-index (object): cluster lsn applied to a state machine
  • config (object): cluster settings
  • logs (array): cluster logs

ReadonlyStatements

  • Type: array