Creating a replication cluster

To create a replication cluster, you must set its name at a minimum.

If you are creating a single cluster or the first cluster, you may omit the path option. In this case, the data_dir option will be used as the cluster path. However, for all subsequent clusters, you must specify the path and the path must be available. The nodes option may also be set to list all nodes in the cluster.

‹›
  • SQL
  • JSON
  • PHP
  • Python
  • Python-asyncio
  • javascript
  • Java
  • C#
  • Rust
📋
CREATE CLUSTER posts
CREATE CLUSTER click_query '/var/data/click_query/' as path
CREATE CLUSTER click_query '/var/data/click_query/' as path, 'clicks_mirror1:9312,clicks_mirror2:9312,clicks_mirror3:9312' as nodes

If authentication and authorization is enabled, the effective replication user must have replication permission on the cluster target. You can specify that user in the CREATE CLUSTER statement:

GRANT replication ON 'posts' TO 'repl_user';
CREATE CLUSTER posts 'repl_user' AS user;

If no user is specified, the current session user is used for the statement and stored as the cluster user after successful creation.

Before other auth-enabled nodes join or manage the cluster, provision the stored cluster user with matching authentication data and replication permission on those nodes.

If the nodes option is not specified when creating a cluster, the first node that joins the cluster will be saved as the nodes option.

Last modified: June 16, 2026