检查监控和负载均衡器的数据库可用性

验证 Redis Software 数据库是否可用于执行读取和写入作,以及是否可以响应来自客户端应用程序的查询。

Redis 企业软件

您可以使用数据库可用性 API 来验证 Redis Software 数据库是否可用于执行读取和写入作,以及是否可以响应来自客户端应用程序的查询。负载均衡器和自动监控工具可以使用此 API 来监控数据库可用性。

注意:
数据库可用性并不能保证数据可用性。

检查数据库可用性以进行监控

要监控数据库可用性,请使用以下 REST API 请求:

GET /v1/bdbs/<database_id>/availability

If the OSS Cluster API is enabled, this request verifies all endpoints for this database are available. Otherwise, it verifies the database has at least one available endpoint.

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.

Check local database endpoint availability for load balancers

To check database availability when using a load balancer and the recommended all-nodes proxy policy, use the local database endpoints for each node:

GET /v1/local/bdbs/<database_id>/endpoint/availability

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.

Availability by database status

The following table shows the relationship between a database's status and availability. For more details about the database status values, see BDB status field.

Database status Availability
active Available
active-change-pending Available
creation-failed Not available
delete-pending ⚠️ Availability not guaranteed
import-pending Available
pending Available
recovery Not available
RATE THIS PAGE
Back to top ↑