Configuring Replication
Configure GridGain 9 clusters for data center replication with the CLI tool — create, start, scope, secure, monitor, and end replications.
This chapter explains how to configure your GridGain clusters for data replication by using the CLI tool.
Preparing for Replication
Data replication pulls updates from a remote cluster, called the source cluster. The cluster the data is copied to is called replica cluster.
By default, data center replication assumes that the source and replica clusters share the same schema. Pre-existing rows on the replica that have no corresponding row on the source are not affected by replication. When the same row is present on both clusters, GridGain resolves the conflict using the rule described in Conflict Resolution.
Any change in source schema will cause the replication to stop. If this happens, update the schema on target manually and resume replication.
All dcr commands require MANAGE_DCR privilege, including read-only dcr list and dcr status commands. The example below shows how you can grant it to the role:
GRANT PRIVILEGES MANAGE_DCR TO dcr_admin;Connecting to Source Server
To connect to a source cluster, use the dcr create command:
dcr create --name replication_name --source-cluster-address=127.0.0.1:10800This command will create the replication on the replica cluster, but not start the replication process yet. You can review the configuration and make sure the source cluster is prepared for replication prior to Starting Replication. No additional configuration on source cluster is required.
You can also specify multiple nodes from the same cluster, in which case GridGain will connect to the first node listed, or the first node that it can establish connection to. It then establishes background connections to other nodes and uses those connections if the connection to the primary node fails:
dcr create --name replication_name --source-cluster-address=127.0.0.1:10800,127.0.0.1:10801,127.0.0.2:10800This command creates a connection, but does not start replication on its own. The name of the replication will be used later to address it in the commands.
If the replica cluster restricts source cluster addresses, every address you specify must be allowed. For details, see Restricting Source Cluster Addresses.
Starting Replication
Active-Passive Replication
To start replication, use the dcr start command:
The cluster will start the data replication process from the cluster running on the 127.0.0.1 address, and will copy all tables from the PUBLIC schema.
To replicate all tables from all schemas, omit --schema:
When the replication is first started, GridGain performs a special operation called full state transfer, copying the existing data from the source cluster to the replica cluster.
Afterwards, updates committed on the source cluster are continuously applied to the replica cluster.
You can configure more specific replication by limiting the scope or nodes that are allowed to participate as described in the Replication Configuration section.
Active-Active Replication
The only difference between starting active-passive and active-active replication is that you need to configure the both clusters to replicate data to each other.
The example below assumes that you have 2 nodes on addresses 127.0.0.1 and 127.0.0.2 that belong to different clusters. Then, it configures replication on both clusters targeting each other.
Conflict Resolution
If the data was updated on both clusters before the data was replicated, the update with a later timestamp will be kept.
One-Time Replication
In some scenarios, it is not necessary to copy data dynamically. Instead, you can flush data once. When running the flush command, you specify the replication time in ISO format. All data up to that point will be replicated, and then the replication will stop automatically.
Replication Configuration
Limiting Replicating Nodes
Each replication runs on a single elected worker node on the replica cluster. By default, any node in the replica cluster is eligible to be elected. Because the worker node carries the load of pulling and applying changes, you may want to restrict the role to a subset of nodes — for example, to keep replication off nodes that handle latency-sensitive application traffic. To do this, list the eligible node names in --replication-nodes when creating the replication. GridGain elects the worker from this list and re-elects from the remaining list members if the current worker leaves the cluster.
Limiting Replication Scope
Replication is tracked on a per-table basis, so you can replicate data only from some tables in the cluster. To do this, use the tables option instead of all.
To replicate specific tables from a single schema, specify --schema and use unqualified table names:
To replicate specific tables from the PUBLIC schema, omit --schema (unqualified table names default to PUBLIC):
To replicate tables from multiple schemas in one command, use fully-qualified table names (SCHEMA.TABLE). You can mix qualified and unqualified names — unqualified names default to the PUBLIC schema:
You can add more tables to the replication process after it is started by running dcr start again for the new tables:
You can stop replication of specific tables as well:
In this case, the replication will continue for all other tables.
Replication on Secured Clusters
If your cluster has security enabled, you need to provide user credentials to the dcr create command to establish secure connection and authorization. The user needs to have a role with permissions that allow them to read and write to the tables that are being replicated.
If your cluster is further secured by using SSL, you need to provide keystore and truststore that will be used to connect to it in the dcr create command:
Restricting Source Cluster Addresses
By default, a replication can connect to any source cluster address. The only addresses refused by default are IP addresses in the link-local, any-local, and multicast ranges, and the IP addresses of known cloud instance metadata services. Host names are not checked: GridGain does not resolve them, so a host name is accepted even if it resolves to one of these addresses. To limit the addresses that replications on the replica cluster can connect to, set the ignite.dcr.sourceClusterAddressAllowList cluster configuration property:
Each entry is a host name or IP address, optionally followed by a port. An entry without a port allows any port on that host. A source cluster address without a port uses the default port 10800. GridGain does not resolve host names when it compares addresses, so to allow a host by both its name and its IP address, list both. When the list is not empty, only the listed addresses are allowed, including addresses that are refused by default.
GridGain checks the source cluster addresses when a replication is created or started:
dcr createanddcr startfail with theGG-DCR-14error if any address is not allowed.If GridGain restarts a replication automatically, for example to retry after an error, and an address is no longer allowed, the replication moves to the
FAILEDstate.
Changes to the list take effect without a cluster restart. A replication that is already running keeps running until it is started again, either with dcr start (for example, to add tables) or automatically after a node restart or an error. At that point, its addresses are checked against the current list. You can always stop a replication, whatever the list contains.
Checking Replication Status
You can list the currently existing replications by using the list command:
This command lists all existing replications and their statuses. You can get more in-depth information on each replication by using the status command:
Ending Replication
To stop replication, first stop the replication process for all tables:
This stops the replica cluster from pulling further updates, but does not delete the replication configuration. Replication can be resumed by running dcr start again on the same name.
To completely remove the replications, use the delete command:
This will permanently delete the replication configuration. If replication is recreated, it will need to first synchronize the clusters, instead of resuming where it stopped before.
This page is: Copyright © 2026 MariaDB. All rights reserved.
Last updated
Was this helpful?

