MethodPathDescription
GET/v1/bdbsGet all databases
GET/v1/bdbs/{uid}Get a single database
PUT/v1/bdbs/{uid}Update database configuration
PUT/v1/bdbs/{uid}/{action}Update database configuration and perform additional action
POST/v1/bdbsCreate a new database
POST/v2/bdbsCreate a new database
DELETE/v1/bdbs/{uid}Delete a database

Get all databases

GET /v1/bdbs

Get all databases in the cluster.

Permissions

Permission nameRoles
view_all_bdbs_infoadmin
cluster_member
cluster_viewer
db_member
db_viewer

Request

Example HTTP request

GET /v1/bdbs?fields=uid,name

Headers

KeyValue
HostThe domain name or IP of the cluster
Acceptapplication/json

Query parameters

FieldTypeDescription
fieldsstringComma-separated list of field names to return (by default all fields are returned). (optional)

Response

The response body contains a JSON array with all databases, represented as BDB objects.

Body

[
    {
        "uid": 1,
        "name": "name of database #1",
        "// additional fields..."
    },
    {
        "uid": 2,
        "name": "name of database #2",
        "// additional fields..."
    }
]

Status codes

CodeDescription
200 OKNo error

Example requests

cURL

$ curl -k -X GET -u "[username]:[password]" \
       -H "accept: application/json" \
       https://[host][:port]/v1/bdbs?fields=uid,name

Python

import requests
import json

url = "https://[host][:port]/v1/bdbs?fields=uid,name"
auth = ("[username]", "[password]")

headers = {
  'Content-Type': 'application/json'
}

response = requests.request("GET", url, auth=auth, headers=headers)

print(response.text)

Get a database

GET /v1/bdbs/{int: uid}

Get a single database.

Permissions

Permission nameRoles
view_bdb_infoadmin
cluster_member
cluster_viewer
db_member
db_viewer

Request

Example HTTP request

GET /bdbs/1

Headers

KeyValue
HostThe domain name or IP of the cluster
Acceptapplication/json

URL parameters

FieldTypeDescription
uidintegerThe unique ID of the database requested.

Query parameters

FieldTypeDescription
fieldsstringComma-separated list of field names to return (by default all fields are returned). (optional)

Response

Returns a BDB object.

Example JSON body

{
    "uid": 1,
    "name": "name of database #1",
    "// additional fields..."
}

Status codes

CodeDescription
200 OKNo error
404 Not FoundDatabase UID does not exist

Update database configuration

PUT /v1/bdbs/{int: uid}

Update the configuration of an active database.

If called with the dry_run URL query string, the function will validate the BDB object against the existing database, but will not invoke the state machine that will update it.

This is the basic version of the update request. See Update database and perform action to send an update request with an additional action.

To track this request’s progress, poll the /actions/<action_uid> endpoint with the action_uid returned in the response body.

Permissions

Permission nameRoles
update_bdbadmin
cluster_member
db_member

Request

Example HTTP request

PUT /bdbs/1

Headers

KeyValue
HostThe domain name or IP of the cluster
Acceptapplication/json
Content-typeapplication/json

Query parameters

FieldTypeDescription
dry_runValidate the new BDB object but don’t apply the update.

URL parameters

FieldTypeDescription
uidintegerThe unique ID of the database for which update is requested.

Body

Include a BDB object with updated fields in the request body.

Example JSON body
{
    "replication": true,
    "data_persistence": "aof"
}

The above request attempts to modify a database configuration to enable in-memory data replication and append-only file data persistence.

Response

Returns the updated BDB object.

Example JSON body

{
    "uid": 1,
    "replication": true,
    "data_persistence": "aof",
    "// additional fields..."
}

Status codes

CodeDescription
200 OKThe request is accepted and is being processed. The database state will be ‘active-change-pending’ until the request has been fully processed.
404 Not FoundAttempting to change a nonexistent database.
406 Not AcceptableThe requested configuration is invalid.
409 ConflictAttempting to change a database while it is busy with another configuration change. In this context, this is a temporary condition, and the request should be reattempted later.

Error codes

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

CodeDescription
rack_awareness_violation• Non rack-aware cluster.
• Not enough nodes in unique racks.
invalid_certificateSSL client certificate is missing or malformed.
certificate_expiredSSL client certificate has expired.
duplicated_certsAn SSL client certificate appears more than once.
insufficient_resourcesShards count exceeds shards limit per bdb.
not_supported_action_on_crdtreset_admin_pass action is not allowed on CRDT enabled BDB.
name_violationCRDT database name cannot be changed.
bad_shards_blueprintThe sharding blueprint is broken or doesn’t fit the BDB.
replication_violationCRDT database must use replication.
eviction_policy_violationLFU eviction policy is not supported on bdb version<4
replication_node_violationNot enough nodes for replication.
replication_size_violationDatabase limit too small for replication.
invalid_oss_cluster_configurationBDB configuration does not meet the requirements for OSS cluster mode
missing_backup_intervalBDB backup is enabled but backup interval is missing.
crdt_sharding_violationCRDB created without sharding cannot be changed to use sharding
invalid_proxy_policyInvalid proxy_policy value.
invalid_bdb_tagsTag objects with the same key parameter were passed.
unsupported_module_capabilitiesNot all modules configured for the database support the capabilities needed for the database configuration.
redis_acl_unsupportedRedis ACL is not supported for this database.

Update database and perform action

PUT /v1/bdbs/{int: uid}/{action}

Update the configuration of an active database and perform an additional action.

If called with the dry_run URL query string, the function will validate the BDB object against the existing database, but will not invoke the state machine that will update it.

Permissions

Permission nameRoles
update_bdb_with_actionadmin
cluster_member
db_member

Request

Example HTTP request

PUT /bdbs/1/reset_admin_pass

The above request resets the admin password after updating the database.

Headers

KeyValue
HostThe domain name or IP of the cluster
Acceptapplication/json
Content-typeapplication/json

URL parameters

FieldTypeDescription
uidintegerThe unique ID of the database to update.
actionstringAdditional action to perform. Currently supported actions are: flush, reset_admin_pass.

Query parameters

FieldTypeDescription
dry_runValidate the new BDB object but don’t apply the update.

Body

Include a BDB object with updated fields in the request body.

Example JSON body
{
    "replication": true,
    "data_persistence": "aof"
}

The above request attempts to modify a database configuration to enable in-memory data replication and append-only file data persistence.

Note:
To change the shard hashing policy, you must flush all keys from the database.

Response

If the request succeeds, the response body returns the updated BDB object. If an error occurs, the response body may include an error code and message with more details.

Status codes

CodeDescription
200 OKThe request is accepted and is being processed. The database state will be ‘active-change-pending’ until the request has been fully processed.
403 Forbiddenredislabs license expired.
404 Not FoundAttempting to change a nonexistent database.
406 Not AcceptableThe requested configuration is invalid.
409 ConflictAttempting to change a database while it is busy with another configuration change. In this context, this is a temporary condition, and the request should be reattempted later.

Error codes

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

CodeDescription
rack_awareness_violation• Non rack-aware cluster.
• Not enough nodes in unique racks.
invalid_certificateSSL client certificate is missing or malformed.
certificate_expiredSSL client certificate has expired.
duplicated_certsAn SSL client certificate appears more than once.
insufficient_resourcesShards count exceeds shards limit per bdb.
not_supported_action_on_crdtreset_admin_pass action is not allowed on CRDT enabled BDB.
name_violationCRDT database name cannot be changed.
bad_shards_blueprintThe sharding blueprint is broken or doesn’t fit the BDB.
replication_violationCRDT database must use replication.
eviction_policy_violationLFU eviction policy is not supported on bdb version<4
replication_node_violationNot enough nodes for replication.
replication_size_violationDatabase limit too small for replication.
invalid_oss_cluster_configurationBDB configuration does not meet the requirements for OSS cluster mode
missing_backup_intervalBDB backup is enabled but backup interval is missing.
crdt_sharding_violationCRDB created without sharding cannot be changed to use sharding
invalid_proxy_policyInvalid proxy_policy value.
invalid_bdb_tagsTag objects with the same key parameter were passed.
unsupported_module_capabilitiesNot all modules configured for the database support the capabilities needed for the database configuration.
redis_acl_unsupportedRedis ACL is not supported for this database.

Create database v1

POST /v1/bdbs

Create a new database in the cluster.

The request must contain a single JSON BDB object with the configuration parameters for the new database.

The following parameters are required to create the database:

ParameterType/ValueDescription
namestringName of the new database
memory_sizeintegerSize of the database, in bytes

If passed with the dry_run URL query string, the function will validate the BDB object, but will not invoke the state machine that will create it.

To track this request’s progress, poll the /actions/<action_uid> endpoint with the action_uid returned in the response body.

The cluster will use default configuration for any missing database field. The cluster creates a database UID if it is missing.

Permissions

Permission nameRoles
create_bdbadmin
cluster_member
db_member

Request

Example HTTP request

POST /bdbs

Headers

KeyValue
HostThe domain name or IP of the cluster
Acceptapplication/json
Content-typeapplication/json

Query parameters

FieldTypeDescription
dry_runValidate the new BDB object but don’t create the database.

Body

Include a BDB object in the request body.

The following parameters are required to create the database:

ParamterType/ValueDescription
namestringName of the new database
memory_sizeintegerSize of the database, in bytes

The uid of the database is auto-assigned by the cluster because it was not explicitly listed in this request. If you specify the database ID (uid), then you must specify the database ID for every subsequent database and make sure that the database ID does not conflict with an existing database. If you do not specify the database ID, then the it is automatically assigned in sequential order.

Defaults are used for all other configuration parameters.

Example JSON body

{
    "name": "test-database",
    "type": "redis",
    "memory_size": 1073741824
}

The above request is an attempt to create a Redis database with a user-specified name and a memory limit of 1GB.

Response

The response includes the newly created BDB object.

Example JSON body

{
    "uid": 1,
    "name": "test-database",
    "type": "redis",
    "memory_size": 1073741824,
    "// additional fields..."
}

Error codes

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

CodeDescription
uid_existsThe specified database UID is already in use.
missing_db_nameDB name is a required property.
missing_memory_sizeMemory Size is a required property.
missing_moduleModules missing from the cluster.
port_unavailableThe specified database port is reserved or already in use.
invalid_shardingInvalid sharding configuration was specified.
bad_shards_blueprintThe sharding blueprint is broken.
not_rack_awareCluster is not rack-aware and a rack-aware database was requested.
invalid_versionAn invalid database version was requested.
busyThe request failed because another request is being processed at the same time on the same database.
invalid_data_persistenceInvalid data persistence configuration.
invalid_proxy_policyInvalid proxy_policy value.
invalid_sasl_credentialsSASL credentials are missing or invalid.
invalid_replicationNot enough nodes to perform replication.
insufficient_resourcesNot enough resources in cluster to host the database.
rack_awareness_violation• Rack awareness violation.
• Not enough nodes in unique racks.
invalid_certificateSSL client certificate is missing or malformed.
certificate_expiredSSL client certificate has expired.
duplicated_certsAn SSL client certificate appears more than once.
replication_violationCRDT database must use replication.
eviction_policy_violationLFU eviction policy is not supported on bdb version<4
invalid_oss_cluster_configurationBDB configuration does not meet the requirements for OSS cluster mode
memcached_cannot_use_modulesCannot create a memcached database with modules.
missing_backup_intervalBDB backup is enabled but backup interval is missing.
wrong_cluster_state_idThe given CLUSTER-STATE-ID does not match the current one
invalid_bdb_tagsTag objects with the same key parameter were passed.
unsupported_module_capabilitiesNot all modules configured for the database support the capabilities needed for the database configuration.
redis_acl_unsupportedRedis ACL is not supported for this database.

Status codes

CodeDescription
403 Forbiddenredislabs license expired.
409 ConflictDatabase with the same UID already exists.
406 Not AcceptableInvalid configuration parameters provided.
200 OKSuccess, database is being created.

Create database v2

POST /v2/bdbs

Create a new database in the cluster. See POST /v1/bdbs for more information.

The database’s configuration should be under the “bdb” field.

This endpoint allows you to specify a recovery_plan to recover a database. If you include a recovery_plan within the request body, the database will be loaded from the persistence files according to the recovery plan. The recovery plan must match the number of shards requested for the database.

The persistence files must exist in the locations specified by the recovery plan. The persistence files must belong to a database with the same shard settings as the one being created (slot range distribution and shard_key_regex); otherwise, the operation will fail or yield unpredictable results.

If you create a database with a shards_blueprint and a recovery plan, the shard placement may not fully follow the shards_blueprint.

Request

Example HTTP request

POST /v2/bdbs

Headers

KeyValue
HostThe domain name or IP of the cluster
Acceptapplication/json
Content-typeapplication/json

Query parameters

FieldTypeDescription
dry_runValidate the new BDB object but don’t create the database.

Body

Include a JSON object that contains a BDB object and an optional recovery_plan object in the request body.

Example JSON body
{
    "bdb": {
        "name": "test-database",
        "type": "redis",
        "memory_size": 1073741824,
        "shards_count": 1
    },
    "recovery_plan": {
        "data_files": [
            {
                "shard_slots": "0-16383",
                "node_uid": "1",
                "filename": "redis-4.rdb"
            }
        ]
    }
}

Response

The response includes the newly created BDB object.

Example JSON body

{
    "uid": 1,
    "name": "test-database",
    "type": "redis",
    "memory_size": 1073741824,
    "shards_count": 1,
    "// additional fields..."
}

Delete database

DELETE /v1/bdbs/{int: uid}

Delete an active database.

Permissions

Permission nameRoles
delete_bdbadmin
cluster_member
db_member

Request

Example HTTP request

DELETE /bdbs/1

Headers

KeyValue
HostThe domain name or IP of the cluster
Acceptapplication/json

URL parameters

FieldTypeDescription
uidintegerThe unique ID of the database to delete.

Response

Returns a status code that indicates the database deletion success or failure.

Status codes

CodeDescription
200 OKThe request is accepted and is being processed. The database state will be ‘delete-pending’ until the request has been fully processed.
403 ForbiddenAttempting to delete an internal database.
404 Not FoundAttempting to delete a nonexistent database.
409 ConflictEither the database is not in ‘active’ state and cannot be deleted, or it is busy with another configuration change. In the second case, this is a temporary condition, and the request should be re-attempted later.