Maintenance API
Note
Available in Nexus Repository Pro only when HA-C is Enabled
Note
High Availability Clustering is a legacy feature that only works on the Orient database.
All new deployments should use one of our new high availability or resilient deployment options described in Resiliency and High Availability.
Introduction
These HA-C specific REST endpoints allow the user to inspect and manipulate the state of a node in an Orient database cluster. The expectation is that these will be used mainly for troubleshooting and recovery operations.
Possible Database Names: component, config, security
Endpoints
Check Database
PUT /service/rest/v1/maintenance/{databaseName}/check
Checks database pages for corruption and checks that indices cover all records (i.e. no duplicates).
curl -u admin:admin123 -X PUT http://localhost:8081/service/rest/v1/maintenance/component/check
Example Response
{ "pageCorruption" : false, "indexErrors" : 0 }
Reinstall Database
PUT /service/rest/v1/maintenance/{databaseName}/reinstall
Attempts to reinstall the full database from the rest of the cluster.
Note
The user can't force a reinstall from a specific node, but typically Orient will choose the node that most recently took a backup or the oldest member (assuming that's not the node requesting the reinstall)
curl -u admin:admin123 -X PUT http://localhost:8081/service/rest/v1/maintenance/component/reinstall
Example Response
{ "reinstalled" : true }
Database Role
This attribute represents the role of the database node in an Orient cluster. The role of MASTER represents a fully writable database node in an Orient cluster which participates in the writeQuorum
. The role of REPLICA represents a database node in read-only mode which is accepting only idempotent commands, e.g. read and queries.
Possible Roles: MASTER, REPLICA
Get Role
GET /service/rest/v1/maintenance/{databaseName}/role
curl -u admin:admin123 -X GET http://localhost:8081/service/rest/v1/maintenance/component/role
Example Response
MASTER
Set Role
PUT /service/rest/v1/maintenance/{databaseName}/role
When setting a database node's role to REPLICA an override is added to Orient's configuration so that node will always be a REPLICA, regardless of the cluster's default role. When the database node is set back to MASTER that override is removed, so it will defer to the cluster's default role - which is MASTER unless it's been frozen.
curl -u admin:admin123 -X PUT http://localhost:8081/service/rest/v1/maintenance/component/role -H "Content-Type: text/plain" -d "MASTER"
Example Response
Database Status
This attribute represents the status of the database node in an Orient cluster. The status of ONLINE represents a database node in a normal state which is fully participating in the cluster. The status of OFFLINE represents a database node that is not currently participating in the cluster. The status of NOT_AVAILABLE represents a database node that is not currently available for some reason.
Possible Statuses: ONLINE, OFFLINE, NOT_AVAILABLE
Get Status
GET /service/rest/v1/maintenance/{databaseName}/status
curl -u admin:admin123 -X GET http://localhost:8081/service/rest/v1/maintenance/component/status
Example Response
ONLINE
Set Status
PUT /service/rest/v1/maintenance/{databaseName}/status
Note
Setting the database status to NOT_AVAILABLE triggers an automatic delta-sync with the rest of the cluster. If this is successful, it will move back to ONLINE.
curl -u admin:admin123 -X PUT http://localhost:8081/service/rest/v1/maintenance/component/status -H "Content-Type: text/plain" -d "ONLINE"