LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 03-03-2005, 04:40 PM   #1
wooshyFox
Member
 
Registered: Feb 2005
Distribution: debian sarge
Posts: 113

Rep: Reputation: 15
dynamic dns for backup server?


Hi - I new this is an old problem, but I wan tto know if there is a newish solution....

I want to set up a backup server to my current webserver. I have got the websites backed up on to it with rsync and am setting up a daily copy. What i would *really* like is that age old goal of having web requests switch to the reserve server if the main one fails....

I know this used to be impossible, but is there any way i can do it by using a dynamic dns service (like everydns) - so that if one ip address disapears, the dns could point to the other one?

...or am i getting the entire wrong end of the stick? Any ideas anyone?
(sorry if this has been answered elsewhere - please point me in the right direction if it has, and ill go away )
 
Old 03-03-2005, 05:02 PM   #2
wooshyFox
Member
 
Registered: Feb 2005
Distribution: debian sarge
Posts: 113

Original Poster
Rep: Reputation: 15
...like setup dynamic dns for all the domains on the server and have the ip register script run on reboot to tell the everydns nameservers that all the domains should point to this ip.
Then run a script on the backup server to check to see if the main server is still alive (every 5 minutes or so), and if there's no response it could run the same script but telling the nameserver that the ip address is now (the ip address for the backup server)....

is this a flawed idea (i haven't really understood much about it so far cause everydns dont really document it)?
 
Old 03-04-2005, 11:05 AM   #3
wooshyFox
Member
 
Registered: Feb 2005
Distribution: debian sarge
Posts: 113

Original Poster
Rep: Reputation: 15
...ok _ I have set up apache for one of the domains on both main and backup servers...

...I have added a dynamic DNS record on everydns.net for that domain...

I run the little perl script that they provide and tell their nameservers that the domain is on the master server, wait for 5 minutes and the domain resolves to the master server ok....

wait another 5 minutes and run the script again telling their nameservers that the domain is on the backup server, wait 5 minutes and lo - the domain resolves to the backup server..... almost seamless.

All I need now is a cron script to run on the backup server every 5/10 minutes to see if the main server is serving up webpages; if it is then no change (or register the main server ip address); if not register the backup server ip address to the everydns nameservers.

Anyone help me out (shell scripts are not my strong point) - specially with the bit that checks to see if a webpage request works (dont want to use ping cause this doesnt tell me if apache's running - also I have my dns set so that the boxes are not pingable) ....

NB It should ideally email me a notification if the main server is down or comes back up)
 
Old 03-04-2005, 11:06 AM   #4
wooshyFox
Member
 
Registered: Feb 2005
Distribution: debian sarge
Posts: 113

Original Poster
Rep: Reputation: 15
...ever felt like you were talking to yourself?

Obviously no-one wants to have a backup webserver - OR there is a much better, more obvious way that everyone is already using.....
 
Old 03-04-2005, 11:59 AM   #5
wooshyFox
Member
 
Registered: Feb 2005
Distribution: debian sarge
Posts: 113

Original Poster
Rep: Reputation: 15
OK I've made a start on the shell script... (it's very basic so far coz I'm no good at it!).

it should have some way to store the current state so it only sends me an email and updates the ddns when the state changes (rather than everytime it runs)... it should also have some error checking to see if the dns update works succesfully (otherwise it might not switch over)... and it might need some better way of checking wether the main servers apache service is running (otherwise it might switch over unnecesssarily - if theirs just a bit of delay for instance - at the mo it just tries to wget the page 10 times).

I have placed a small placeholder text file in the root directory of the main server (this does NOT get backed up with rsync! otherwise it would be imposssible to tell which machine was serving)...

#check to see if the main apache server is up (look for a file in some.domain.com)
if wget some.domain.com/placeholder.txt --spider --tries 10 --quiet
then
#wget was succesful so main server is up and running...
echo "Main Apache server is running ok..."
# perl eDNS.pl -u everydnsusername -p everydnspassword -ip ipaddressofmainserver
else
#wget could not retrieve the file so server is not working for some reason...
echo "Main server is down - switching to Backup server..."
# perl eDNS.pl -u everydnsusername -p everydnspassword -ip ipaddressofbackupserver
/usr/sbin/sendmail -t <<EOF
To: <myemailaddress>
From: <backup@backupserverdomain>
Cc: <>
<>
Subject: Main Apache server is down!

The Main Apache server is down (or someone has deleted the placeholder.txt file from the /var/www directory)

The Backup server is standing in for it...


EOF


fi
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamic DNS Server. NickCoons Linux - Networking 6 10-20-2005 04:17 AM
Dynamic DNS server shane200_ SUSE / openSUSE 1 07-14-2005 06:34 PM
Own DNS server possible with dynamic IP nizbit Linux - Networking 3 01-01-2005 09:59 AM
I want to be a dynamic dns server. jmanjohn61 Linux - Software 0 01-19-2004 08:40 AM
Mail Server with Dynamic DNS? jhandle Linux - Newbie 3 12-30-2003 03:21 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 08:05 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration