Question
We have an upcoming requirement to relocate the server "ns.provider.com".
We intend on moving it to an entirely different network, where it will have a new backnet and frontnet IP address and will essentially be a new server.
Can you please provide a rough guideline as to how we could do this?
Answer
Basic procedure is the following:
Add new nameserver in another location
Appropriate documentation page can be used as a reference. "Deploying Linux-based DNS Servers" chapter
- Use attached script to synchronize all DNS zones to a new server
- Decomission old server, make sure that all appropriate tasks completed successfully
This procedure will allow to keep server redudancy. But, if you need to re-use the same server and there so no chance to add a new one (step 1), then the procedure will be changed:
- Decomission old server, make sure that all appropriate tasks completed successfully
- Add the same server in a new location (with new network parameters)
- Use attached script to synchronize all DNS zones to a new server
Please be advised that there are several possible aftermathes:
- If you have 2 nameservers in OSA configuration and the second one shall fail during relocation hosting infrastructure shall stay without DNS service
- Some domain registrars have a requirement to have at least 2 nameserver to register a domain. If you decomission 1 server and only 1 left - domain registration will be impossible
- In case of significant nuber of domains (several thousands) the synchronization procedure can be extremely long: divide domains in portions to avoid system overload
Several additional recommendations
By default when you add a new DNS server in OSA configuration only newly created domains shall be propagated on a new server. If you need to propagate old domains too - please use 'pem.syncNameServers' API method to sync. Another way is to do it manually - choose a domain in "Domains" tab, switch zone to external and then back to internal hosting.
- In case of significant number of domains it is strongly recommended to divide list of domains in several smaller portions. Script below can be used as a reference.
Script
#!/bin/bash
psql -Uplesk -h`hostname` plesk -c "SELECT d.name FROM domains d JOIN accounts a ON (a.account_id = d.owner_id) JOIN dns_zones z ON (z.zone_id = d.zone_id) JOIN domains dp ON (dp.zone_id = z.zone_id AND dp.dns_path = z.name AND dp.deleted != 'y') WHERE ((a.path >= (SELECT ap.path||'x' FROM accounts ap WHERE ap.account_id = 1) AND a.path < (SELECT ap.path||'y' FROM accounts ap WHERE ap.account_id = 1)) OR a.account_id = 1) AND d.deleted != 'y' AND (d.is_locked = 0 ) ORDER BY d.domain_id" > domains.txt
sed '1,2 d;' domains.txt > domains2.txt
sed -e 's/^.\{1\}//' domains2.txt > domains.txt
sed 'N;$!P;$!D;$d' domains.txt > domains_final.txt
rm -f domains2.txt
rm -f domains.txt
while read i
do
echo "<?xml version=\"1.0\"?><methodCall><methodName>pem.syncNameServers</methodName><params><param><value><struct><member><name>domain_name</name><value><string>$i</string></value></member></struct></value></param></params></methodCall>" | curl -k http://192.168.41.1:8440 -d@-
sleep 10
done < /root/domains_final.txt