How to Bulk Update TTL on Plesk for server migration

Re: Preparing for a Plesk server migration, Bulk change TTL on Plesk

Occasionally you need to move all your clients to a new server. The hardware becomes aged (or slow) but the thought of moving all those clients (hundreds) and the DNS propagation time delay, not something that makes you feel great.

However, you can minimise the DNS propagation times by changing the TTL (Time To Live) on the Plesk domain DNS records. Usually the refresh rate is between daily and weekly. In preparation for a server migration, around a week before, change all domains to update ‘hourly’. You can do this in the panel for each domain name, or you can use this nifty shortcut.

First, change all the TTL’s to 3600 seconds (1 hour)

# mysql -uadmin -p`cat /etc/psa/.psa.shadow` psa
 UPDATE psa.dns_zone SET ttl = '3600', ttl_unit = '60' WHERE id >1;

Now you need to dump the new SOA records to zone files for bind to us:

# mysql -Ns -uadmin -p`cat /etc/psa/.psa.shadow` -D psa -e 'select name from domains' | awk '{print "/usr/local/psa/admin/sbin/dnsmng update " $1 }' | sh

You can test with:

# dig yourdomnain.co.uk SOA

When you have completed the migration and everything is fine, you can change the records back to the default which was 86400.

Was this helpful?
How to Bulk Update TTL on Plesk for server migration written by UKC average rating 5/5 - 2 user ratings

3 thoughts on “How to Bulk Update TTL on Plesk for server migration”

  1. The second command is truncated, it should have read:
    mysql -Ns -uadmin -p`cat /etc/psa/.psa.shadow` -D psa -e ‘select name from domains’ | awk ‘{print “/usr/local/psa/admin/sbin/dnsmng update ” $1 }’ | sh

Comments are closed.