Creating Redis clusters
A Redis cluster consists of one or more database hosts you can configure replication between. Replication is enabled by default in any cluster consisting of more than one host: the master host accepts write requests and asynchronously duplicates changes on replicas.
For more about Managed Service for Redis cluster structure, see Resource relationships in Managed Service for Redis.
Note
The number of hosts you can create together with a Redis cluster depends on the selected host class.
How to create a Redis cluster
-
In the management console
, go to the folder to create a DB cluster in. -
Select Managed Service for Redis.
-
Click Create cluster.
-
Under Basic parameters:
- Enter a name for the cluster in the Cluster name field. The cluster name must be unique within the folder.
- (Optional) Add a cluster description.
-
Under Host class:
- Select a platform in the Platform field.
- Specify the Type of the VM to deploy hosts on.
- Select a host configuration that defines the technical specifications of the VMs where the DB hosts will be deployed. Changing the configuration changes the properties of all the previously created hosts.
-
Under Cluster configuration, in the Password field, set the user password.
The password must be between 8 and 128 characters long. The password must meet the
[a-zA-Z0-9@=+?*.,!&#$^<>_-]*
regular expression. -
Under Hosts:
-
To change the settings of a host, click the
icon in the line with its name.- Availability zone: Select an availability zone.
- Subnet: Specify a subnet in the selected availability zone.
- Shard name: Enables you to change the shard name for the host. The field is only available if the cluster is created with the enabled Cluster sharding setting.
-
To add hosts to the cluster, click Add host.
-
-
Configure the DBMS settings, if required.
-
Click Create cluster.
If you don't have the Nebius AI command line interface yet, install and initialize it.
The folder specified in the CLI profile is used by default. You can specify a different folder using the --folder-name
or --folder-id
parameter.
To create a cluster:
-
Check whether the folder has any subnets for the cluster hosts:
ncp vpc subnet list
-
View a description of the create cluster CLI command:
ncp managed-redis cluster create --help
-
When you create a cluster from the CLI, you can't explicitly specify the host type and amount of RAM. Choose the applicable host class instead. To see what host classes are available, run the command:
ncp managed-redis resource-preset list
-
Specify the cluster parameters in the create command (only some of the supported flags are given in the example):
ncp managed-redis cluster create \ --name <cluster name> \ --network-name <network name> \ --host zone-id=<availability zone>,` `subnet-id=<subnet ID>,` `replica-priority=<host priority> \ --resource-preset <host class> \ --password=<user password>
You need to specify
subnet-id
if the selected availability zone has two or more subnets.The password must be between 8 and 128 characters long. The password must meet the
[a-zA-Z0-9@=+?*.,!&#$^<>_-]*
regular expression.
Examples
Creating a single-host cluster
To create a cluster with a single host, provide a single --host
parameter.
Create a Managed Service for Redis cluster with test characteristics:
- Named
myredis
. - Network
default
. - A single
s3-c2-m8
-class host in theb0rcctk2rvtr8efcch64
subnet in theeu-north1-c
availability zone with a host priority of50
. - With the
user1user1
password. - With protection against accidental cluster deletion.
Run the following command:
ncp managed-redis cluster create \
--name myredis \
--network-name default \
--resource-preset s3-c2-m8 \
--host zone-id=eu-north1-c,subnet-id=b0rcctk2rvtr8efcch64,replica-priority=50 \
--password=user1user1 \
--deletion-protection=true