codership / galera

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

Multi Datacenter Public/Private IP #636

Open lechiefe opened 1 year ago

lechiefe commented 1 year ago

Hello, I am working on setting up a multi-datacenter environment in which each datacenter will house several nodes.

Each node has a public IP (WAN) and a private IP (LAN).

My goal is to have the nodes in each datacenter (DC1, DC2, DC3) connect to each other using the private IPs, but use the public IPs to reach across datacenters. Right now I am able to only define one IP address, similar to the following : wsrep_provider_options=ist.recv_addr=<publicIp>:4568;ist.recv_bind=0.0.0.0:4568 --wsrep_node_incoming_address=<publicIp> --wsrep_sst_receive_address=<publicIp>

This is undesirable as it wastes bandwidth, and causes network lag when nodes in the same datacenter talk to each other. Instead I would like to be able to do something like the following: wsrep_provider_options=ist.recv_addr=<publicIp>:4568,<PRIVATEIP>:4568;ist.recv_bind=0.0.0.0:4568 --wsrep_node_incoming_address=<publicIp>,<PRIVATEIP> --wsrep_sst_receive_address=<publicIp>,<PRIVATEIP>

and have the nodes choose public or private based of the gmcast.segment value.

Here is an image to visualize the situation: image

As you can see there is no reason for the nodes in DC1 to use WAN to talk to other nodes in the same datacenter(DC1) and same same goes for others, but right now this does not seem achievable without some sort of proxy.

Can someone advise as to whether this is possible with just galera configuration?

Thanks in advance!