How to (Safely) Change a DNS Record
How do I change my DNS records to point to a web host?
I’m changing CDN services, how do I update my DNS records?
How do I transfer my domain to a different DNS host?
If I change a record, will there be any downtime?
Our support team answers questions like these on a daily basis, but the more important question is how do you change these records safely. A lot of webmasters and developers think they can just change a record and expect nothing to go wrong. Well, it most likely will. It’s all thanks to caches (pronounced like cash).
Ever notice that when you visit a web page more than once it will load significantly faster? That’s because the content required to load the page is already stored in your browser’s cache. The same goes for DNS information. Record configurations are stored in the caches of your browser and many different servers. If you try and make a record change, it can take an hour or even two days for the changes to propagate.
Let’s say you changed a record that says anyone querying your site should be sent to the IP address 18.104.22.168, but not you want them to go to 22.214.171.124 instead… until their cache refreshes, they are going to be pointed toward the old configuration at 126.96.36.199. Since the old configuration doesn’t exist anymore, it will appear that your website is offline. But fear not! There is a fix.
TTL’s and Caches
Whenever you create a record you will get the option to change the TTL, or Time to Live. In DNS Made Easy the default TTL is always set to 1800 seconds (or 30 minutes). This is relatively short, and most clients will change this to a longer period of time. The longer a TTL, the less load it puts on the authoritative name server. Unless you are making frequent changes, you’ll want to make the TTL at least an hour or even a day long.
If you need to change a record (or create a record if you are transferring from one service to another) you will want to change your TTL to as low as possible. The shorter your TTL, the less amount of time your site could possibly be down. If someone tries to query your website during this time, their query may not resolve if their resolving server has not refreshed its cache yet. Servers will usually refresh every hour.
How to Safely Change a Record
- Lower the TTL of the record to as low as possible (30 seconds is recommended).
- Make your record changes.
- Wait at least an hour.
- Change the TTL back to your previous time.
- Enjoy no down time during your record change!
Originally published at DNS Made Easy News.