# Replicating your DNS data

The conventional setup for DNS services has an instance of `tinydns` serving your public data, on an IP address delegated-to by superdomain content DNS servers from a (shared) database file.

To replicate the data that are published to other `tinydns` servers, just copy the `data` file and compile it with `tinydns-data` on the copied-to machine.

>     admin@b.ns.example ~ %cd ~publicfile/dns
>     admin@b.ns.example ~publicfile/dns %rsync --compress a.ns.example:/home/publicfile/dns/data .
>     admin@b.ns.example ~publicfile/dns %tinydns-data
>     admin@b.ns.example ~publicfile/dns %

Yes, it is as simple as using `rsync`.

In fact, any method that will copy a file from one location to another is satisfactory. Bernstein djbdns always has been neutral with respect to how one copies files. One could even use the `cp` command, for example, or the `uucp` command, or Zmodem, or SneakerNet. `rsync` and `scp` are no more than suggestions.

No, do not use "zone transfer".

"zone transfer" even ("incremental zone transfer") is hopelessly inefficient, uses the DNS protocol with its (in Bernstein's own words) sophomoric compression scheme, and lacks the ability to transfer any of the things (such as location codes, time to die, temporarily disabled addresses, and even comments) that have never been understood by "zone transfer". Simple file copying of the `data` source file preserves all of these, effortlessly; and with general-purpose file copying tools, proper compression, and no special DNS-only protocol involved.

No, do not copy `data.cdb`

One of the guarantees required by `tinydns` and provided by `tinydns-data` is that `data.cdb` is never in a partly-written state. This is why it compiles to a temporary file, renames it once it has fully completed writing it, and the `data.cdb` file is never modified again. ("cdb" is short for Bernstein's Constant DataBase file format.) `rsync` et al. do not provide this guarantee and will mess up DNS service for the period that the file is in the partly-copied state. If you really want to copy compiled files around, then copy them to a temporary name and rename them over the target after the copy has fully completed successfully.