Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Basically I have a simple free host (000webhost.com) that I used to use. Now I have my own machine to host a website. however, when I'm updating stuff on that machine, or anything that might make the computer to go down temporarily, I would like the other host to be able to host the site until the first one is back up.

On my new hosting computer I'm using Ubuntu server, using lamp stack (apache, mysql, php), and am using wordpress.

share|improve this question
1  
I'd recommend trying out AWS free tier: aws.amazon.com/free You can get some proper load balancing and failover out of it too if you're willing to pay a few pennies now and then. –  Tanner Jan 11 '13 at 15:51
1  
Somewhat related: varnish-cache.org/docs/3.0/tutorial/… –  deizel Jan 11 '13 at 19:28

4 Answers 4

up vote 3 down vote accepted

What you're talking about is a Network Load Balance setup, in that both machines use a shared virtual IP in a round robin arrangement. When one goes down, the NLB stops routing calls to that box, and the other box gets all the requests until the first box comes back up.

The problem with NLB is, it doesn't enforce sync between the two servers, it's just a traffic cop. So you'd need some other arrangement to ensure that your content is synced between the two systems. NLB typically is used across two or more (we use groups of five) web servers that are for all intents and purposes identically configured.

The arrangement that you're using (hosting locally AND on a leased remote system) is a bit backward, IMO. I would recommend that you push all your "production" content to the web host, and use your local system for development and testing only.

share|improve this answer
    
when I say hosting locally, I ment I got a new computer meant for dedecating hosting, not a local working enviorment. I also have a 3rd local host for developing on (my laptop). it might be a good thing that the two don't host identically. I might want to disable commenting and stuff on the onlnie host, so I don't have to worry about putting the comments in the first server when it goes back online –  QxQ Jan 11 '13 at 17:31
1  
The problem that you're facing here is that your hosting spans two networks, so that you must resort to a DNS redirect to switch the 'active' web host from one to the other. This is a time-consuming fix, which requires both hosts to be up (and sync'd) during the DNS TTL period, while the transition is taking place. An NLB solution typically has all hosts in the same subnet, so that they can be coordinated properly. Or, one could simply switch the IP's (which is what I do with my shoutcast servers, they're identical VM's with access to a shared external drive). –  George Erhard Jan 14 '13 at 16:55

The simplest solution in just to change the DNS to make it points to the new website

share|improve this answer
    
Doesnt that have a propagation time of around 48 hours? –  Akash Jan 11 '13 at 16:52
    
That was years ago. Currently DNS changes propagates in just a few minutes or even less. –  jap1968 Jan 11 '13 at 18:08
    
@jap1968: That depends on the TTL... My host's DNS, for example, has it set to 24 hours, and I cannot change it. Thus, my changes do not propagate "in just a few minutes." –  BlueRaja Jan 11 '13 at 20:26

Based upon the question I think it is clear the OP clearly wants this to switch on / off when a server is down (when up, take traffic, when down, point else where) with instant results.

This can't be done.

If the computer is down, then so is everything that is being hosted. If the computer is down, then you can't run any forwarding scripts from that machine, meaning the only way is if on the registrar's site (where domain name is registered) you could try and get a server response and on error, forward to a different IP.

Updating DNS records I don't think will work, simpily because typically it takes up to 72 hours to propagate and OP says it's only during the machine going down 'temporarily'.

share|improve this answer
    
This can be done. It's just not a good way to do it. –  Tanner Jan 11 '13 at 15:36
    
@r.tanner.f Please explain how then –  Dave Jan 11 '13 at 15:37
    
Change the DNS records to point to another host. –  Tanner Jan 11 '13 at 15:37
3  
It's possible to decrease the DNS TTL duration, depending on your nameserver. The one I currently use will allow me to decrease it to 60 seconds. The only issue is if a caching server caches it for longer than the TTL specifies, but there isn't really anything that can be done with such nonstandard behaviour. –  Bob Jan 11 '13 at 15:45
2  
It might be possible by pointing all web traffic to a third host, and letting that forward it to either the webhost or the backup webhost. Inefficient though. A proper " dev - test - production" setup would be much better. –  Hennes Jan 11 '13 at 15:48

There's a technology call Web Server Clustering, just like Google, facebook, microsoft, i'm sure they have a lot of identical server serving the entire internet request. one single server from those is not able to meet the demand of the entire web community.

Facebook.com for example has mutiple ipaddress (A record) that points to different IP Address.

But I'm not sure how it's setup.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.