Search code examples
postgresqlgoogle-cloud-platformhigh-availabilitygoogle-cloud-networkinggoogle-vpc

Floating local IP for multiple Virtual Machines


On Google Cloud Platform I need to create two virtual machines that will act as the main server and replication server (as a database).

It happens that I will have several applications that will connect to the main server, which requires me to define in these applications the local network IP (VPC) of this main machine.

My problem occurs when there is some failure on the main machine or even an emergency/maintenance reboot. This type of operation will require me to urgently change all applications to use the replication machine's VPC IP instead of the main one.

Is there any way I can have one IP that can be dedicated to connect to the main machine, but when necessary, change its destination to be the replication machine?


Solution

  • Instead use an internal L7 load balancer. See the comparision in order to decide if this is suitable. This PDF explains the stack - and envoyproxy.io is the load balancer. Andromeda even implements round robin, but for NIC instead of IP.

    Also see: Patterns for using floating IP addresses in Compute Engine