Is it possible to have two write-able mariadb's in a set of four?
I have a pair of mariadb servers running on CentOS 7, version 5.5.52. Currently the Server 1 writes and reads and replicates to Server 2. I want to add two mariadb servers in AWS. I want one of these servers, Server 3, to read and write, I want it to replicate to Servers 1, 2 and 4; that is, I want replication to occur across all mariadb servers. I also want Server 1 to replicate to the other three.
Link to schematic: https://www.flickr.com/photos/80050932@N06/51535391218/in/dateposted-public/
My question is, is this possible and thoughts on how to enable.
autossh is the tunnel that handles replication. Here is a line in
/usr/lib/systemd/system/autossh.service that may offer insight:
User=root ExecStart=/usr/bin/autossh -M 0 -N -q -o "ServerAliveInterval=60" -o "ServerAliveCountMax=3" -p 22 -l replica Server1 -L 3305:127.0.0.1:3306 -i /root/.keys/replica
Answer Answered by Markus Mäkelä in this comment.
This is what would be called a multi-master setup with more than one server where writes occur. To configure it, you can use multi-source-replication.
It can work as long as you guarantee that no two writes can ever conflict between Server 1 and Server 3. This is usually quite hard to guarantee if you intend the same applications to write to both Server1 and Server 3. One option would be to use a Galera cluster but the performance might not be optimal if the nodes are located far apart.