codership / galera

Synchronous multi-master replication library
GNU General Public License v2.0
447 stars 177 forks source link

Synchronous vs. Asynchronous Replication #654

Open sabahsawor opened 7 months ago

sabahsawor commented 7 months ago

This is not an issue question, but I'm not sure where I have to post this question.

I want to deploy both Synchronous vs. Asynchronous on the same time, basically I need to setup a 3 of mysql nodes as a cluster on AWS (Synchronous replication) and one node in our on premise server with Asynchronous replication.

I'm not sure if Galera have this capability

ayurchen commented 7 months ago

Hi, Galera itself does not have this capability, but you can use any Galera cluster node as a primary for native MySQL asynchronous replication.

To be able to seamlessly switch master nodes make sure to set

log_replica_updates=1
wsrep_sync_server_uuid=1
sabahsawor commented 7 months ago

Hi, Galera itself does not have this capability, but you can use any Galera cluster node as a primary for native MySQL asynchronous replication.

To be able to seamlessly switch master nodes make sure to set

log_replica_updates=1
wsrep_sync_server_uuid=1

Thank you Alexey for your answer,

So your idea is to add 4 nodes (3 in AWS cloud servers and one in premise server) to Galera cluster and set the one in premise with the setting you provided?

6eh01der commented 5 months ago

@sabahsawor , hello. You should you use this parameters at all galera nodes.

log_replica_updates is required for binlog that required for classic async MySQL replication.

wsrep_sync_server_uuid - about this option you could read here https://galeracluster.com/library/documentation/mysql-wsrep-options.html

Node that will receive async replication will not be galera cluster node, it'll be just standalone MySQL that will receive data by classic replication mechanism.

Some links:

https://severalnines.com/blog/how-setup-asynchronous-replication-between-mariadb-galera-clusters/

Another variant is that your on prem node will be part of the cluster but with another segment - https://severalnines.com/blog/deploying-hybrid-infrastructure-environment-percona-xtradb-cluster/

https://galeracluster.com/library/documentation/galera-parameters.html#gmcast-segment

Replication will work by the same galera mechanism (wsrep) but with some location optimisations.