Back to Redis

Availability

content/operate/rs/references/rest-api/requests/bdbs/availability.md

latest6.6 KB
Original Source
MethodPathDescription
GET/v1/local/bdbs/{uid}/endpoint/availabilityVerifies local database endpoint availability
GET/v1/bdbs/{uid}/availabilityVerifies database availability

Get database endpoint availability {#get-db-endpoint-availability}

sh
GET /v1/local/bdbs/{uid}/endpoint/availability

Verifies the local database endpoint is available. This request does not redirect to the primary node.

Permissions

Permission nameRoles
[view_bdb_info]({{< relref "/operate/rs/references/rest-api/permissions#view_bdb_info" >}})admin
cluster_member
cluster_viewer
db_member
db_viewer
user_manager

Request {#get-endpoint-request}

Example HTTP requests

To check database endpoint availability without any additional checks:

sh
GET /v1/local/bdbs/1/endpoint/availability

To perform a lag-aware database endpoint availability check using the cluster's default lag tolerance threshold:

sh
GET /v1/local/bdbs/1/endpoint/availability?extend_check=lag

To perform a lag-aware database endpoint availability check and override the cluster's default lag tolerance threshold:

sh
GET /v1/local/bdbs/1/endpoint/availability?extend_check=lag&availability_lag_tolerance_ms=100

Headers

KeyValueDescription
Hostcnm.cluster.fqdnDomain name
Acceptapplication/jsonAccepted media type

URL parameters

FieldTypeDescription
uidintegerThe unique ID of the database.

Query parameters

FieldTypeDescription
extend_checklist of comma-separated stringsList of additional availability checks to perform (optional)
Values:
lag: Enables lag-aware checks to assess replication health. Determines if a replica is sufficiently synced with the primary for failover/failback scenarios.
availability_lag_tolerance_msintegerOverrides the cluster's default lag tolerance threshold when using extend_check=lag. Recommended value: 100 milliseconds.

Response {#get-endpoint-response}

Returns the status code 200 OK if the local database endpoint is available.

If the local database endpoint is unavailable, returns an error status code and a JSON object that contains error_code and description fields.

Error codes {#get-endpoint-error-codes}

When errors are reported, the server may return a JSON object with error_code and description fields that provide additional information. The following are possible error_code values:

CodeDescription
no_quorumMaster healthcheck failed (no quorum in the cluster)
db_not_foundDatabase does not exist in the cluster
bdb_endpoint_unavailableLocal database endpoint is not available

Status codes {#get-endpoint-status-codes}

CodeDescription
200 OKDatabase endpoint is available.
400 Bad RequestInvalid schema.
404 Not FoundDatabase not found.
503 Service UnavailableDatabase endpoint is unavailable.

Get database availability {#get-db-availability}

sh
GET /v1/bdbs/{uid}/availability

Gets the availability status of a database.

  • If the OSS Cluster API is enabled, verifies all endpoints for this database are available.

  • Otherwise, verifies the database has at least one available endpoint.

Permissions

Permission nameRoles
[view_bdb_info]({{< relref "/operate/rs/references/rest-api/permissions#view_bdb_info" >}})admin
cluster_member
cluster_viewer
db_member
db_viewer
user_manager

Request {#get-db-request}

Example HTTP requests

To check database availability without any additional checks:

sh
GET /v1/bdbs/1/availability

To perform a lag-aware database availability check using the cluster's default lag tolerance threshold:

sh
GET /v1/bdbs/1/availability?extend_check=lag

To perform a lag-aware database availability check and override the cluster's default lag tolerance threshold:

sh
GET /v1/bdbs/1/availability?extend_check=lag&availability_lag_tolerance_ms=100

Headers

KeyValueDescription
Hostcnm.cluster.fqdnDomain name
Acceptapplication/jsonAccepted media type

URL parameters

FieldTypeDescription
uidintegerThe unique ID of the database.

Query parameters

FieldTypeDescription
extend_checklist of comma-separated stringsList of additional availability checks to perform (optional)
Values:
lag: Enables lag-aware checks to assess replication health. Determines if a replica is sufficiently synced with the primary for failover/failback scenarios.
availability_lag_tolerance_msintegerOverrides the cluster's default lag tolerance threshold when using extend_check=lag. Recommended value: 100 milliseconds.

Response {#get-db-response}

Returns the status code 200 OK if the database is available.

If the database is unavailable, returns an error status code and a JSON object that contains error_code and description fields.

Error codes {#get-db-error-codes}

When errors are reported, the server may return a JSON object with error_code and description fields that provide additional information. The following are possible error_code values:

CodeDescription
no_quorumMaster healthcheck failed (no quorum in the cluster)
db_not_foundDatabase does not exist in the cluster
bdb_unavailableDatabase is not available

Status codes {#get-db-status-codes}

CodeDescription
200 OKDatabase is available.
400 Bad RequestInvalid schema.
404 Not FoundDatabase not found.
503 Service UnavailableDatabase is unavailable or doesn't have quorum.