启用 OSS 集群 API
Redis 企业软件 |
---|
查看 Redis OSS 集群 API,以确定是否应该为数据库启用此功能。
先决条件
仅当数据库满足特定条件时,才支持 Redis OSS 集群 API。
数据库必须:
此外,数据库不得:
- 使用节点
include
或exclude
在代理策略中。 - 使用 RediSearch、RedisTimeSeries 或 RedisGears 模块。
OSS 集群 API 设置适用于单个数据库,而不是整个集群。
启用 OSS 集群 API 支持
您可以使用 Cluster Manager UI 或rladmin
实用程序为数据库启用 OSS 集群 API 支持。
集群管理器 UI
当您使用集群管理器 UI 启用 OSS 集群 API 时,它会自动配置先决条件。
要在集群管理器 UI 中为现有数据库启用 OSS 集群 API,请执行以下作:
您还可以使用 Cluster Manager UI 在创建新数据库时启用该设置。
命令行 (rladmin
)
您可以使用rladmin
效用为 Redis Enterprise Software 数据库(包括数据库副本)启用 OSS Cluster API。
对于主动-主动 (CRDB) 数据库,请使用 crdb-cli 实用程序。
确保已配置先决条件。然后,从命令行为 Redis 数据库启用 OSS 集群 API:
$ rladmin tune db <database name or ID> oss_cluster enabled
To determine the current setting for a database from the command line, use
rladmin info db
to return the value of the oss_cluster
setting.
$ rladmin info db test | grep oss_cluster:
oss_cluster: enabled
The OSS Cluster API setting applies to the specified database only; it does not apply to the cluster.
Active-Active databases
Ensure the prerequisites have been configured. Then, use the crdb-cli
utility to enable the OSS Cluster API for Active-Active databases:
$ crdb-cli crdb update --crdb-guid <GUID> --oss-cluster true
For best results, you should do this when you first create the database.
Here's the basic process:
-
Create the Active-Active database:
$ crdb-cli crdb create --name <name> \
--memory-size 10g --port <port> \
--sharding true --shards-count 2 \
--replication true --oss-cluster true --proxy-policy all-master-shards \
--instance fqdn=<fqdn>,username=<user>,password=<pass> \
--instance fqdn=<fqdn>,username=<user>,password=<pass> \
--instance fqdn=<fqdn>,username=<user>,password=<pass>
-
Obtain the CRDB-GUID ID for the new database:
$ crdb-cli crdb list
CRDB-GUID NAME REPL-ID CLUSTER-FQDN
<CRDB-GUID> Test 4 cluster1.local
-
Use the CRDB-GUID ID to enable the OSS Cluster API:
$ crdb-cli crdb update --crdb-guid <CRDB-GUID> \
--oss-cluster true
The OSS Cluster API setting applies to all of the instances of the Active-Active database.
Turn off OSS Cluster API support
To deactivate OSS Cluster API support for a database, either:
-
Use the Cluster Manager UI to turn off the OSS Cluster API toggle from the database Configuration settings.
-
Use the appropriate utility to deactivate the OSS Cluster API setting.
For standard databases, including Replica Of, use rladmin
:
$ rladmin tune db <name or ID> oss_cluster disabled
For Active-Active databases, use crdb-cli
:
$ crdb-cli crdb update --crdb-guid <CRDB-GUID> \
--oss-cluster false
Multi-key command support
When you enable the OSS Cluster API for a database,
multi-key commands are only allowed when all keys are mapped to the same slot.
To verify that your database meets this requirement, make sure that the CLUSTER KEYSLOT
reply is the same for all keys affected by the multi-key command. To learn more, see multi-key operations.
On this page