Previous Section  < Day Day Up >  Next Section

Recipe 24.14. Synchronizing with a Second tinydns Server

24.14.1 Problem

You have a second tinydns server offsite, as a backup. How do you keep it synchronized with your main tindydns server?

24.14.2 Solution

Plain old rsync-over-ssh does the job just fine. This simple script copies your DNS data file to the backup, then runs make on the remote data file:

rsync -e ssh -az /etc/tinydns/root/data $backup-host:/etc/tinydns/root/data

ssh $backup-host "cd /etc/tinydns/root; make"

Replace $backup-host with the name or IP address of the remote server.

You can automate the entire process by adding these lines to /etc/tinydns/root/Makefile, so that when you run the make command on your primary server after updating /etc/tinydns/root/data, the backup will automatically be updated as well:

data.cdb: data

       /usr/local/bin/tinydns-data

       rsync -e ssh -az /etc/tinydns/root/data $backup-host:/etc/tinydns/root/data

       ssh $backup-host "cd /etc/tinydns/root; make"

24.14.3 Discussion

Moving plain old text files doesn't require a lot of sophistication; rsync is a fine tool for the job. You may schedule regular updates via cron, or add transport security and authentication with encrypted ssh keys.

Your backup server can also function as your secondary DNS server. You can configure client PCs to use it, or register it just like your main DNS server for a public authoritative DNS server (see Recipe Recipe 24.6).

24.14.4 See Also

    Previous Section  < Day Day Up >  Next Section