'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 1:[1]

It's not clear which div you want to put this text in, but you can add a click listener to each checkbox to do this.

document.querySelectorAll("input[type=checkbox]").forEach(function(chkbx) {
  var chkbxFunc = function (e) {
    var txt = e.target.nextSibling;
    txt = txt.nodeValue;
    //put txt in another div
  }
  chkbx.addEventListener("change", chkbxFunc);
});

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 ControlAltDel