恢复数据库请求
用于数据库恢复的 REST API 请求
Redis 企业软件 |
---|
方法 | 路径 | 描述 |
---|---|---|
获取 | /v1/bdbs/{uid}/actions/recover |
获取数据库恢复计划 |
发布 | /v1/bdbs/{uid}/actions/recover |
恢复数据库 |
获取恢复计划
GET /v1/bdbs/{int: uid}/actions/recover
Fetches the recovery plan for a database. The recovery plan provides information about the recovery status, such as whether recovery is possible, and details on available files to use for recovery.
Required permissions
Permission name
Roles
view_bdb_recovery_plan
admin
cluster_member
cluster_viewer
db_member
db_viewer
Request
Example HTTP request
GET /v1/bdbs/1/actions/recover
URL parameters
Field
Type
Description
uid
integer
The unique ID of the database.
Response
Returns a JSON object that represents the database's recovery plan, including recovery files and status.
Example response body
{
"data_files": [
{
"filename": "appendonly-1.aof",
"last_modified": 1721164863.8883622,
"node_uid": "1",
"shard_role": "master",
"shard_slots": "1-2048",
"shard_uid": "1",
"size": 88
},
{
"filename": "appendonly-2.aof",
"last_modified": 1721164863.8883622,
"node_uid": "2",
"shard_role": "slave",
"shard_slots": "2049-4096",
"shard_uid": "2",
"size": 88
}
],
"status": "ready"
}
Status codes
Code
Description
200 OK
No error.
404 Not Found
Database UID does not exist.
Recover database
POST /v1/bdbs/{int: uid}/actions/recover
Initiates recovery for a database in a recoverable state where all the database's files are available after cluster recovery.
Required permissions
Permission name
Roles
start_bdb_recovery
admin
cluster_member
db_member
Request
The request body can either be empty or include a recovery plan.
If the request body is empty, the database will be recovered automatically:
-
Databases with no persistence are recovered with no data.
-
Persistent files such as AOF or RDB will be loaded from their expected storage locations where replica or primary shards were last active.
-
If persistent files are not found where expected but can be located on other cluster nodes, they will be used.
Example HTTP request
POST /v1/bdbs/1/actions/recover
Example request body
{
"data_files": [
{
"filename": "appendonly-1.aof",
"node_uid": "1",
"shard_slots": "1-2048"
},
{
"filename": "appendonly-2.aof",
"node_uid": "2",
"shard_slots": "2049-4096"
}
],
"ignore_errors": false,
"recover_without_data": false
}
URL parameters
Field
Type
Description
uid
integer
The unique ID of the database to recover.
Response
Returns a status code. Also returns a JSON object with an action_uid
in the request body if successful.
Status codes
Code
Description
200 OK
The request is accepted and is being processed. When the database is recovered, its status will become active
.
404 Not Found
Attempting to perform an action on a nonexistent database.
409 Conflict
Database is currently busy with another action, recovery is already in progress, or is not in a recoverable state.
On this page