Maintenance API

Available in Nexus Repository Pro

Introduction

These REST endpoints allow the user to inspect and manipulate the state of a node in Orient database cluster. The expectation is that these will be used mainly for troubleshooting and recovery operations.

Possible Database Names: accesslog, 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
{
  "pageCorruption" : false,
  "indexErrors" : 0
}


Reinstall Database

Only available in HA-C

PUT /service/rest/v1/maintenance/{databaseName}/reinstall

Attempts to reinstall the full database from the rest of the cluster.

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
{
  "reinstalled" : true
}


Repair Database

PUT /service/rest/v1/maintenance/{databaseName}/repair

Attempts to repair any corrupt database pages and rebuilds indices.

curl -u admin:admin123 -X PUT http://localhost:8081/service/rest/v1/maintenance/component/repair
{
  "indexErrorsRemaining" : 0,
  "repairedPages" : 0
}


Database Role

Only available in HA-C

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
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"
 

Database Status

Only available in HA-C

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
ONLINE

Set Status

PUT /service/rest/v1/maintenance/{databaseName}/status

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"