How to create a simple "http file not found" failover between two droplets in the same data center using floating IPs?

Trying to create fail-over between two droplets in the same data center using floating IP. The droplets are running NGINX with a module that’s constantly generating a new status.html file. If there is a problem, status.html will no longer be produced and is automatically cleared. All that’s needed for the the failover test, is if http://PrimaryDroplet/status.html is not found, then floating IP should route to http://BackupDroplet/status.html. I am looking for the simplest way of implementing such a failover. I have already read the Floating IPs tutorial that references Corosync and Pacemaker, Keepalived and Heartbeat. Is there a SIMPLER way of implementing this scheme? Thanks.


Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Thanks for your reply. The point is not load balancing, but failover; i.e. having redundancy. In this case a passive node (cold standby) is exactly what’s needed. Some applications are important enough to justify placing them on standby. Note, the backup droplet will continue to receive the same feed as the primary; but not any requests – that is, until the primary fails.

To me it appears that:

  • If the resource is load balanced it should be the same regardless of the droplet that serves it.
  • If the resource differs between hosts, surely the different versions should be at a different urls.

When you have a load balanced setup it doesn’t make a lot of sense to have a “cold standby” just sitting there waiting for the “active” one to fail - You’re paying to have the droplet running, you might as well have each of them serve 1/n of your traffic.

(Obviously It depends heavily on the level of control you have over the code that generates your status. If it’s super expensive to run you might not want to run it at full force on 2 droplets - but maybe it’s not that intensive)