Can I have two droplets located at the US and Europe that resolve the same domain?

March 10, 2014 1k views
Can I have two droplets located at the US and Europe that resolve the same domain? That would be very helpful for two main reasons: 1. It would help load balance my traffic. 2. It would effectively kill downtime when rebooting my web apps. Is this possible?
1 Answer
The easy way to do this would be with something called "Round Robin DNS Load Balancing" Basically in your DNS setup, you have two entries for your website that point to both IP addresses.

Example in BIND DNS config file:

www.website.com. IN A 192.168.0.1 #US Address
www.website.com. IN A 192.168.0.2 # European Address


When someone accesses your website, the DNS server will respond with one of the two IPs. They will then use that IP for however long the TTL is (usually 4-6 hours).

It won't matter where in the world they are. If one of your servers goes down, half the people will get a website, and the other half will not.

There are other options of load balancing, HAProxy, nginx, etc, but those are fairly complex setups.
Have another answer? Share your knowledge.