Current Configuration
I currently have 3 servers:
- server
australia
with the databasecanberra
- servers
belgium
andgermany
are a galera cluster with the databasebruxelles
.
Target Configuration
My final goal is to merge both databases into a single galera cluster:
- servers
australia
,belgium
andgermany
will be a galera cluster with the databasescanberra
andbruxelles
.
Constraints and leeways
australia
, belgium
and germany
are public production servers. They all handle read and write queries from various clients 24/7 (SELECT
, INSERT
, UPDATE
, DELETE
), so I cannot allow neither downtime nor read-only for any of them.
canberra
and bruxelles
schemas are obviously distinct, so there is no risk of collision when merging.
canberra
and bruxelles
schemas are stable (no ALTER
), so I can copy the schemas from one server to another at any time, without any need to keep the schemas in sync.
The servers are adressed by clients through DNS aliases :
australia
is behindpacific.example.com
belgium
andgermany
are behindeurope.example.com
(round-robin handled by HAProxy).
It is easy to add or change DNS aliases (eg. edit europe.example.com
to include australia
in the round-robin, or to exclude germany
).
I am not sure that the galera information is relevant for this particular issue, so any answer working for 2 servers (let's say australia
and belgium
) should be easily translatable to my issue.
Naive approach
My plan was the following:
- Initiate a replication where
australia
is the master andbelgium
is the slave. - Have
pacific.example.com
targetgermany
instead ofaustralia
(no more write on the master, all writes on the slave) - Shut down
australia
- Overwrite
australia
as a new galera cluster member behindeurope.example.com
. - Reboot
belgium
removing slave config - Have
pacific.example.com
target the galera cluster.
However, I found myself unable to initiate the replication. Trying to make belgium
a slave of australia
results in the destrution of bruxelles
database.
Question
How would you do it?
COMMIT
-- something like 200ms. Also some wsrep tuning may be necessary to even let it run with nodes that far apart. I suggest you set up a small test platform with 3 nodes and experiment with it -- for tuning, timing, transition, etc.