Clustering
The following operations are available for configuring and managing HarperDB replication.
If you are using NATS for clustering, please see the NATS Clustering Operations documentation.
Add Node
Adds a new HarperDB instance to the cluster. If subscriptions
are provided, it will also create the replication relationships between the nodes. If they are not provided a fully replicating system will be created. Learn more about adding nodes here.
Operation is restricted to super_user roles only
operation (required) - must always be
add_node
hostname or url (required) - one of these fields is required. You must provide either the
hostname
or theurl
of the node you want to addverify_tls (optional) - a boolean which determines if the TLS certificate should be verified. This will allow the HarperDB default self-signed certificates to be accepted. Defaults to
true
authorization (optional) - an object or a string which contains the authorization information for the node being added. If it is an object, it should contain
username
andpassword
fields. If it is a string, it should use HTTPAuthorization
style credentialssubscriptions (optional) - The relationship created between nodes. If not provided a fully replicated cluster will be setup. Must be an object array and include
database
,table
,subscribe
andpublish
:database - the database to replicate
table - the table to replicate
subscribe - a boolean which determines if transactions on the remote table should be replicated on the local table
publish - a boolean which determines if transactions on the local table should be replicated on the remote table
Body
Response: 200
Update Node
Modifies an existing HarperDB instance in the cluster.
Operation is restricted to super_user roles only
Note: will attempt to add the node if it does not exist
operation (required) - must always be
update_node
hostname (required) - the
hostname
of the remote node you are updatingsubscriptions (required) - The relationship created between nodes. Must be an object array and include
database
,table
,subscribe
andpublish
:database - the database to replicate from
table - the table to replicate from
subscribe - a boolean which determines if transactions on the remote table should be replicated on the local table
publish - a boolean which determines if transactions on the local table should be replicated on the remote table
Body
Response: 200
Remove Node
Removes a HarperDB node from the cluster and stops replication, Learn more about remove node here.
Operation is restricted to super_user roles only
operation (required) - must always be
remove_node
name (required) - The name of the node you are removing
Body
Response: 200
Cluster Status
Returns an array of status objects from a cluster.
database_sockets
shows the actual websocket connections that exist between nodes.
Operation is restricted to super_user roles only
operation (required) - must always be
cluster_status
Body
Response: 200
Configure Cluster
Bulk create/remove subscriptions for any number of remote nodes. Resets and replaces any existing clustering setup.
Operation is restricted to super_user roles only
operation (required) - must always be
configure_cluster
connections (required) - must be an object array with each object following the
add_node
schema.
Body
Response: 200
Cluster Set Routes
Adds a route/routes to the replication.routes
configuration. This operation behaves as a PATCH/upsert, meaning it will add new routes to the configuration while leaving existing routes untouched.
Operation is restricted to super_user roles only
operation (required) - must always be
cluster_set_routes
routes (required) - the routes field is an array that specifies the routes for clustering. Each element in the array can be either a string or an object with
hostname
andport
properties.
Body
Response: 200
Cluster Get Routes
Gets the replication routes from the HarperDB config file.
Operation is restricted to super_user roles only
operation (required) - must always be
cluster_get_routes
Body
Response: 200
Cluster Delete Routes
Removes route(s) from the HarperDB config file. Returns a deletion success message and arrays of deleted and skipped records.
Operation is restricted to super_user roles only
operation (required) - must always be
cluster_delete_routes
routes required - Must be an array of route object(s)
Body
Response: 200
Last updated