0

I'm trying out a distributed app using Galera replication topology that needs to support writes if nodes are disconnected from the cluster. The idea was to have an extra MariaDB that is connected to each Galera node through master-master replication:

dbc0 <--> db0 <--> app
 |
dbc1 <--> db1 <--> app
 .
 .
 .
dbcn <--> dbn <--> app

Where the vertical replication between dbc's is Galera and needs to support 100's of nodes and WAN. The horizontal replication is MariaDB master-master within the same linux server but between different lxc containers. The idea is the app would only communicate to the non-Galera db's, and writes would have keys containing the node #, so be guaranteed unique. The sync between nodes can be slow, but the app (in another container) needs to interact quickly with its local db.

After setting it up with server_id's the same on the dbc's and unique on the db's, and log_slave_updates = 1 on the dbc's, it almost works: creating a new table on any dbc creates the tables in all the dbc's and db's. Adding a row in any dbc also shows up everywhere.

Adding a row in a db though successfully replicates to all the dbc's, but doesn't get to the other db's. However, this topology does allow writes to a db when its dbc is turned off, and sync's nicely when the dbc is turned back on to all the other dbc's (but not the db's). Hope this makes sense.

Is there a way to make a write in a db node replicate through both the Galera cluster dbc nodes and their corresponding MariaDB master-master replicated db's? Or any other way to accomplish this?

0

First, Galera should not be used for more than about 5 nodes. This is because each node talks to every other node on each write. This means 100 nodes would have 9900 'connections' among them. And each write involves 99 roundtrip messages.

You have solved the main 'key' problem by ensuring uniqueness. But there are other possible ways of having conflicts.

Furthermore, Galera's approach to re-acquiring a node will not work for you. It will assume the node is corrupt. It will not assume you have inserted valid new records.

Your dual-master setup does not affect what will eventually happen on the Galera nodes.

Are you more vulnerable to server outage? Or network outage?

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.