Skip to main content

Read-Only API

Introduction

This set of endpoints is used to enable and disable read-only mode on the underlying database. This is useful when conducting some maintenance activities.

Warning

This is a system-level feature that prevents changes to the underlying database. Do not use this feature if you want developers to download components from Nexus Repository, as this feature may prevent that from working.

This feature is only appropriate for installs that use the legacy OrientDB embedded database.

Endpoints

Get State

GET /service/rest/v1/read-only

This endpoint allows us to query the current read-only state of the database.

curl -u admin:admin123 -X GET http://localhost:8081/service/rest/v1/read-only

The resulting JSON document contains information about whether or not the database is currently "frozen" (i.e. in read-only mode), the reason why it may have been frozen, and whether or not the freeze was system initiated:

Example Response

{
  "frozen" : false,
  "summaryReason" : "",
  "systemInitiated" : false
}

Enable

POST /service/rest/v1/read-only/freeze

This endpoint allows us to put the database into read-only mode.

curl -u admin:admin123 -X POST http://localhost:8081/service/rest/v1/read-only/freeze

After issuing the freeze action, the database should be in read-only mode.

$ curl -u admin:admin123 -X GET http://localhost:8081/service/rest/v1/read-only
{
  "frozen" : true,
  "summaryReason" : "activated by an administrator at 2018-01-22 15:04:05 +00:00",
  "systemInitiated" : false
}

Release

POST /service/rest/v1/read-only/release

This endpoint allows us to take the database out of read-only mode.

curl -u admin:admin123 -X POST http://localhost:8081/service/rest/v1/read-only/release

After issuing the release action, the database should no longer be in read-only mode.

$ curl -u admin:admin123 -X GET http://localhost:8081/service/rest/v1/read-only
{
  "frozen" : false,
  "summaryReason" : "",
  "systemInitiated" : false
}

Force Release

POST /service/rest/v1/read-only/force-release

In certain rare instances we may need to forcibly take the database out of read-only mode. This endpoint allows us to do that.

curl -u admin:admin123 -X POST http://localhost:8081/service/rest/v1/read-only/force-release

After issuing the force-release action, the database should no longer be in read-only mode.

$ curl -u admin:admin123 -X GET http://localhost:8081/service/rest/v1/read-only
{
  "frozen" : false,
  "summaryReason" : "",
  "systemInitiated" : false
}