Create Replica Cluster
Create a replica cluster is basically cloning a cluster but it sets up a replication layer afterwards from your Source Cluster going to your target cluster (Replica Cluster). Creating a Replica Cluster does copy (or clones) the data from source including its configuration but ensuring that any required parameters such as hostname or IP address are replaced accordingly to have the replica cluster deployment running functional. After the data and configuration is setup on the Slave Cluster, cmon will handle the replication setup to link both clusters to communicate (that is bidirectional replication).
With this feature:
- One node in each cluster will replicate from another node in the other cluster.
- As mentioned earlier, replication will be bi-directional (or uni-directional) between the clusters.
- All nodes in the replica cluster will be read-only by default.
- Active-active clustering is only recommended if applications are only touching disjoint data sets on either cluster since the engine doesn’t offer any conflict detection or resolution.
The following diagram shows you how does it look like for an ideal scenario of a Cluster-to-Cluster replication, where MC as Source Cluster and SC as Replica Cluster:
Support Matrix
The following database cluster types, vendors and topology are supported:
Database | Vendor | Topology | Version Supported |
---|---|---|---|
Galera Cluster | Percona XtraDB Cluster (PXC) | Galera certification-based replication | 5.6.x and later |
Galera Cluster | MariaDB Galera | Galera certification-based replication | 5.6.x and later |
PostgreSQL | PostgreSQL | Standalone, streaming replication | 9.6 and later |
TimescaleDB | TimescaleDB | Standalone, streaming replication | 9.6 and later |
Prerequisites
There are prerequisites that need to be fulfilled prior to the deployment of a replica cluster. See list below:
- Make sure the target database nodes are running on a supported architecture platform and operating system. See Hardware and Operating System.
- Passwordless SSH (SSH using key-based authentication) is configured from the ClusterControl node to all database nodes. See SSH Key-based Authentication.
- Verify that sudo is working properly if you are using a non-root user. See Operating System User.
- The database credentials for admin user/password should be the same from Source Cluster.
Create Replica Cluster Options
When creating a replica cluster, you have two options to choose from:
- Stream data from primary cluster. This option allows you to setup your desired job to clone or copy the data from the primary or Source Cluster via streaming. This means that, copying of data is happening on-demand and this shall add traffic and load to your Source Cluster.
- Stage cluster from a backup. For large dataset or a cluster serving on a high-traffic load, creating a cluster by staging from a backup would be ideal.
Galera Cluster
A minimal setup is comprised of one Galera node (no high availability). Recommended setup should be at least 3-nodes at bare minimum for high availability.
The following vendors and versions are supported for a new deployment:
- Percona XtraDB Cluster - 8.0.
- MariaDB Cluster - 10.4, 10.5, 10.6 (LTS), 10.11 (LTS) and 11.4 (LTS).
Choosing stream data from primary cluster
Streaming data from primary cluster on a Galera Cluster shall do the following:
-
For Percona XtraDB Cluster, it will use Percona Xtrabackup to stream data from its source copying its data to the target node, that is the replica cluster.
-
For MariaDB Galera, it will use Mariabackup to stream data from its source copying its data to the target node, that is the replica cluster.
Default configuration
Creating a replica cluster, the ClusterControl will simply copy the configuration from the Source Cluster, leaving most everything set based on the changes or its default values given during deployment of the cluster (see Default Configuration for deploying a cluster). Other than that, create replica cluster shall have these default configuration but can be modified or changed in the GUI. See the following list below:
- Bi-directional replication is enabled or "On"
- Disable firewall is checked
- Disable SELinux/AppArmor is checked
- Default SSH port is 22
- Default database port is 3306
- Shall use vendor repositories when pulling and instaling packages
- After Replica Cluster is deployed, auto-recovery (Node and Cluster) are enabled.
Deployment steps
-
Go to the Clusters dashboard. Choose your target source cluster and click the ellipsis button (...)
-
Choose Clone/Replicate the cluster → Create replica cluster
-
Choose Stream data from primary cluster to open the GUI for Replicate from <cluster_name> GUI..
-
First step is Cluster details.
-
Specify on the Select primary at this step. In the Cluster replication primary, choose the target primary node where replication link shall be established.
-
Bi-directional replication is set to On. You can turn it off or disable it to have only unidirectional replication.
-
Name your cluster. In the Name field, it is optional but fill-in here the desired name of the cluster.
-
Tags is a drop-down field but can accept input fields. Any existing tags in the drop-down will show up, otherwise, input the new tag to be added.
-
-
Click Continue.
-
Second step is SSH configuration.
-
Specify the SSH Credentials at this step. In the SSH user, input the SSH user, then SSH user key path for the key path (for example /home/clustercontrol/id_rsa.pub). Specify the SSH port if the port is not using the default 22. Specify the SSH sudo password if there is a sudo password for the SSH user being used here.
-
Install software is set to On. You can disable this if you do not want to install the software if the package is already installed. If set to On, ClusterControl will uninstall any existing package found and install the right package and version of the database instead.
-
Security configuration to either disable firewall or SELinux/AppArmor. Leave check if you need to Disable firewall (default). Leave check if you need to Disable SELinux/AppArmor (default). Otherwise uncheck if any of the two needs not be disabled. If you have uncheck Disable SELinux/AppArmor, make sure that you have configured properly to allow creating files and opening sockets for the database to run properly.
-
-
Click Continue.
-
Third step is Node configuration.
-
Specify the Node configuration at this step. Specify the Server port if it's not using default port 3306. Specify the Server data directory if it's not using default
/var/lib/mysql
. -
Specify the database admin user/password. Make sure to have the value of the admin user and password from the source cluster. Specify the database admin user in Admin/Root user field. Specify the database admin password in Admin/Root password* field.
-
Choose the repository in the Repository section. Default is set to Use vendor repositories. Other options are
Do not setup vendor repositories
andCreate new repository
. If choosingDo not setup vendor repositories
, this shall not install the vendor repository leaving to use AppStream or your main repository. If choosingCreate new repository
, this shall create/mirror the vendor's repositories. Deploy with the mirrored repositories. -
Specify the Version of your desired database. When creating a replica, it is best to determine the source version including the minor version number of the Source Cluster.
-
Select the Configuration template. ClusterControl will show the templates that has been added or configured in
/etc/cmon/templates
. For more details see Configuration template -
By default, Enable SSL encryption is enabled or On. If setup does not require SSL (not recommended), opt-out to disable it.
-
By default, Create cluster as readonly is enabled or On. Disable it if Replica Cluster is writable.
-
-
Click Continue.
-
Fourth step is Add nodes.
- Specify the Galera node that will be added and setup as the Replica Cluster. Please note that an odd number of nodes is recommended, i.e., 3, 5, 7, etc. On this part, input the hostname or IP address of the node. Ideally, the cmon will setup the first node added as the node to be acting as a replica of the primary node from the Source Cluster. Make sure that this node has enough resources to handle the replication link from the Source Cluster.
-
Click Continue to proceed the last step Preview.
-
Fifth and the last step is Preview, this is the last step where it shows all the values and choosen options for the ClusterControl to use for setting up the Replica Cluster.
-
Click Finish button to deploy the job.
To be added soon
Recommended Next Steps
PostgreSQL
A minimal setup is comprised of one PostgreSQL standalone primary node (no high availability). For most setup, recommended setup should have at least one replica or standby node. The following vendors and versions are supported for a new deployment:
- PostgreSQL from postgresql.org repository - 12, 13, 14, 15, and 16.
- PostgreSQL from EDB repository - 12, 13, 14, 15, and 16 (requires a valid EDB repository token).
Choosing stream data from primary cluster
Streaming data from the Source Clusters on a PostgreSQL should be established in the primary node since it will act as the primary node for replication. ClusterControl will use pg_basebackup to copy and stream from primary node (the primary node from your Source Cluster) to the replica node (primary node in the Replica Cluster).
Default configuration
Creating a replica cluster, the ClusterControl will simply copy the configuration from the Source Cluster, leaving most everything set based on the changes or its default values given during deployment of the cluster (see Default Configuration for deploying a cluster). Other than that, create replica cluster shall have these default configuration but can be modified or changed in the GUI. See the following list below:
- Bi-directional replication is enabled or "On"
- Disable firewall is checked
- Disable SELinux/AppArmor is checked
- Default SSH port is 22
- Default database port is 5432
- Shall use vendor repositories when pulling and instaling packages
- After Replica Cluster is deployed, auto-recovery (Node and Cluster) are enabled.
Deployment steps
-
Go to the Clusters dashboard. Choose your target source cluster and click the ellipsis button (...)
-
Choose Clone/Replicate the cluster → Create replica cluster
-
Choose Stream data from primary cluster to open the GUI for Replicate from <cluster_name> GUI..
-
First step is Cluster details.
-
Specify on the Select primary at this step. In the Cluster replication primary, choose the target primary node where replication link shall be established.
-
Bi-directional replication is set to On. You can turn it off or disable it to have only unidirectional replication.
-
Name your cluster. In the Name field, it is optional but fill-in here the desired name of the cluster.
-
Tags is a drop-down field but can accept input fields. Any existing tags in the drop-down will show up, otherwise, input the new tag to be added.
-
-
Click Continue.
-
Second step is SSH configuration.
-
Specify the SSH Credentials at this step. In the SSH user, input the SSH user, then SSH user key path for the key path (for example /home/clustercontrol/id_rsa.pub). Specify the SSH port if the port is not using the default 22. Specify the SSH sudo password if there is a sudo password for the SSH user being used here.
-
Install software is set to On. You can disable this if you do not want to install the software if the package is already installed. If set to On, ClusterControl will uninstall any existing package found and install the right package and version of the database instead.
-
Security configuration to either disable firewall or SELinux/AppArmor. Leave check if you need to Disable firewall (default). Leave check if you need to Disable SELinux/AppArmor (default). Otherwise uncheck if any of the two needs not be disabled. If you have uncheck Disable SELinux/AppArmor, make sure that you have configured properly to allow creating files and opening sockets for the database to run properly.
-
-
Click Continue.
-
Third step is Node configuration.
-
Specify the Node configuration at this step. Specify the Server port if it's not using default port 3306. Specify the Server data directory if it's not using default
/var/lib/mysql
. -
Specify the database admin user/password. Make sure to have the value of the admin user and password from the source cluster. Specify the database admin user in Admin/Root user field. Specify the database admin password in Admin/Root password* field.
-
Choose the repository in the Repository section. Default is set to Use vendor repositories. Other options are
Do not setup vendor repositories
andCreate new repository
. If choosingDo not setup vendor repositories
, this shall not install the vendor repository leaving to use AppStream or your main repository. If choosingCreate new repository
, this shall create/mirror the vendor's repositories. Deploy with the mirrored repositories. -
By default, Enable SSL encryption is enabled or On. If setup does not require SSL (not recommended), opt-out to disable it.
-
-
Click Continue.
-
Fourth step is Add nodes.
-
Specify the Primary node that will be added and setup as the Replica Cluster.
-
If there are replicas to be setup and added for the Replica Cluster, fill in the hostname or IP address in the Replica nodes field. Make sure to hit enter or click the + button.
-
-
Fifth step is Extensions. By default, pgvector and PostGIS extensions that ClusterControl supports are disabled.
-
If you want pgvector to be enabled, switch the toggle button to On
-
If you want PostGIS to be enabled, switch the toggle button to On
-
-
Click Continue to proceed the last step Preview.
-
Sixth and the last step is Preview, this is the last step where it shows all the values and choosen options for the ClusterControl to use for setting up the Replica Cluster.
-
Click Finish button to deploy the job.
To be added soon
Recommended Next Steps
TimescaleDB
A minimal setup is comprised of one TimescaleDB standalone primary node (no high availability). Recommended setup should have at least one replica or standby node. The following vendors and versions are supported for a new deployment:
- TimescaleDB - 12, 13, 14, 15 and 16.
Choosing stream data from primary cluster
Streaming data from the Source Clusters on a TimescaleDB should be established in the primary node since it will act as the primary node for replication. ClusterControl will use pg_basebackup to copy and stream from primary node (the primary node from your Source Cluster) to the replica node (primary node in the Replica Cluster).
Default configuration
Creating a replica cluster, the ClusterControl will simply copy the configuration from the Source Cluster, leaving most everything set based on the changes or its default values given during deployment of the cluster (see Default Configuration for deploying a cluster). Other than that, create replica cluster shall have these default configuration but can be modified or changed in the GUI. See the following list below:
- Bi-directional replication is enabled or "On"
- Disable firewall is checked
- Disable SELinux/AppArmor is checked
- Default SSH port is 22
- Default database port is 5432
- Shall use vendor repositories when pulling and instaling packages
- After Replica Cluster is deployed, auto-recovery (Node and Cluster) are enabled.
Deployment steps
-
Go to the Clusters dashboard. Choose your target source cluster and click the ellipsis button (...)
-
Choose Clone/Replicate the cluster → Create replica cluster
-
Choose Stream data from primary cluster to open the GUI for Replicate from <cluster_name> GUI..
-
First step is Cluster details.
-
Specify on the Select primary at this step. In the Cluster replication primary, choose the target primary node where replication link shall be established.
-
Bi-directional replication is set to On. You can turn it off or disable it to have only unidirectional replication.
-
Name your cluster. In the Name field, it is optional but fill-in here the desired name of the cluster.
-
Tags is a drop-down field but can accept input fields. Any existing tags in the drop-down will show up, otherwise, input the new tag to be added.
-
-
Click Continue.
-
Second step is SSH configuration.
-
Specify the SSH Credentials at this step. In the SSH user, input the SSH user, then SSH user key path for the key path (for example /home/clustercontrol/id_rsa.pub). Specify the SSH port if the port is not using the default 22. Specify the SSH sudo password if there is a sudo password for the SSH user being used here.
-
Install software is set to On. You can disable this if you do not want to install the software if the package is already installed. If set to On, ClusterControl will uninstall any existing package found and install the right package and version of the database instead.
-
Security configuration to either disable firewall or SELinux/AppArmor. Leave check if you need to Disable firewall (default). Leave check if you need to Disable SELinux/AppArmor (default). Otherwise uncheck if any of the two needs not be disabled. If you have uncheck Disable SELinux/AppArmor, make sure that you have configured properly to allow creating files and opening sockets for the database to run properly.
-
-
Click Continue.
-
Third step is Node configuration.
-
Specify the Node configuration at this step. Specify the Server port if it's not using default port 3306. Specify the Server data directory if it's not using default
/var/lib/mysql
. -
Specify the database admin user/password. Make sure to have the value of the admin user and password from the source cluster. Specify the database admin user in Admin/Root user field. Specify the database admin password in Admin/Root password* field.
-
Choose the repository in the Repository section. Default is set to Use vendor repositories. Other options are
Do not setup vendor repositories
andCreate new repository
. If choosingDo not setup vendor repositories
, this shall not install the vendor repository leaving to use AppStream or your main repository. If choosingCreate new repository
, this shall create/mirror the vendor's repositories. Deploy with the mirrored repositories. -
By default, Enable SSL encryption is enabled or On. If setup does not require SSL (not recommended), opt-out to disable it.
-
-
Click Continue.
-
Fourth step is Add nodes.
-
Specify the Primary node that will be added and setup as the Replica Cluster.
-
If there are replicas to be setup and added for the Replica Cluster, fill in the hostname or IP address in the Replica nodes field. Make sure to hit enter or click the + button.
-
-
Fifth step is Extensions. By default, pgvector and PostGIS extensions that ClusterControl supports are disabled.
-
If you want pgvector to be enabled, switch the toggle button to On
-
If you want PostGIS to be enabled, switch the toggle button to On
-
-
Click Continue to proceed the last step Preview.
-
Sixth and the last step is Preview, this is the last step where it shows all the values and choosen options for the ClusterControl to use for setting up the Replica Cluster.
-
Click Finish button to deploy the job.
To be added soon