LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Setting up my second box as a backup DNS and Database Replication (https://www.linuxquestions.org/questions/linux-networking-3/setting-up-my-second-box-as-a-backup-dns-and-database-replication-540324/)

netdynamix 03-24-2007 07:28 PM

Setting up my second box as a backup DNS and Database Replication
 
Dear Forum,

I have a server in the US which is acting as my primary HTTP, DNS, POP3, IMAP, SMTP and MySQL server for hosting...
I also have a server in South Africa... My home country which I wish to setup to act as a backup for all of the above services...

Especially DNS backup and Database Replication...

How????
:)

Chris Grant

JimBass 03-26-2007 09:04 AM

The DNS backup is very easy, and the database backup is not much different. First though, a question. Do you want these backups to be functional, IE do you want the backup South African server to also be a DNS server, or simply to contain the files that the DNS server should have (IE the zone where yourdomain.com gets its address and mail exchanger set up)?

If you want a functional DNS backup, then install BIND on the South African Server, with it set as a slave to the master in North America. Go to your registrar, where you purchased the domain names that you use, and add the South African DNS server to the list of authoritative nameservers for your domain.

The named.conf on the slave should either be copied from one of the current slave nameservers, or if none exist, use this as a model:
Code:

zone "example1.com" in {
        type slave;
        file "example1.com";
        masters {North.American.IP.Address;};
};
zone "example2.com" in {
        type slave;
        file "example2.com";
        masters {North.American.IP.Address;};
};

Backups of a database prove tricky, only in that the database is changing, usually much more quickly than a backup could succeed at getting a full copy. The way to get around that is to dump the database to a static file, and then copy that file to the backup server.

Most databases have some of the functionality built into themselves, IE the creation of the static file. You can also use the cron utility to dump.

To transfer the dumped file, I suggest using the rsync, or rsyncd process. Rsync is great for large file transfers, as it only moves across the parts of the file that are different. To that end, I suggest you look into a utility called backuppc, which is available at sourceforge, http://backuppc.sourceforge.net and install it on the South African machine. That doesn't help to make the SA machine a functional DNS/database server, but it will be great for just holding the files, so if something goes wrong with the NA server, you can restore from these backups.

Peace,
JimBass

netdynamix 03-27-2007 04:56 AM

Thank you for your help mate...
You really know your stuff.

Thanks once again.

Chris

JimBass 03-27-2007 08:51 AM

No problem at all man. Since I don't code, I find helping here the best way for me to contribute to the community.

It would help others down the road if you post how you accomplish what you're trying to do. Once you get everything set, a simple "first A, then B" type closure will really help someone else in the same situation out in the future.

Peace,
JimBass

netdynamix 03-27-2007 04:02 PM

Excellent... I will be sure to post once I have finished everything.

One more question though. I now have a third server in the equation... with regards to DNS only, I take it that I just set the third server up as a slave of the first as well, right?

I have forgotten one of the main important services running on my first box. I am running Exim on the Primary server and SendMail on the second and third. Mainly because it came with the default installation of the distributions running on the second and the third.

I want to set the second server (and if that fails, the third server) to keep mail in a spool if the primary server goes offline. So that effectively when the primary server comes back online the MTA on the second (or third) server will delivery it to the primary server.

I hope that I explained that effectively.
I have never done a migration from SendMail to Exim on a machine already running SendMail, so it is new territory to me... I am not sure if it is a simple process or not???

If it is going to be easier to keep SendMail on the second and third servers and just set SendMail to spool, then i'd rather do it that way.

Jim, if you could help me with this little issue then you are a God amoungt men as far as I am concerned!!

JimBass 03-27-2007 07:19 PM

What you are saying makes perfect sense, and is a very common setting. I don't play with sendmail myself, I use qmail and exim4, but it makes little difference. Here is what you need -

In the DNS for the domain (names changed to protect the guilty):
Code:


3600      IN        MX        10 primary.domain.com.
3600      IN        MX        20 secondary.domain.com.

(and below)
primary        IN        A        I.P.Add.Ress
secondary      IN        A        I.PA.dd.Ress

That sends all mail to the primary, unless it can't be reached, in which case it goes to the secondary. The secondary needs to be configured simply to hold the mail until the primary goes back online. That is covered for sendmail in this page -
http://servers.digitaldaze.com/exten...condarymx.html

Don't worry that it is for a virtual server and exchange, it makes no difference what the primary server is. That is a function of the mail exchanger software, not DNS really, beyond setting the preferences in the DNS.

As to the DNS, yes, you could simply copy the named.conf file from the current slave, and run with that on the new server. You may need to add the new slave's IP address to the configuration on the primary DNS server, depending on how it handles the slaves.

Peace,
JimBass


All times are GMT -5. The time now is 12:31 PM.