Jump to content
xisto Community
Sign in to follow this  
kvarnerexpress

How Do I Mirror A Website?

Recommended Posts

After the last batch of hurricanes we lost 5 days of traffic due to power outages in S. Florida.What I really want to do is redirect a visitor to a copy of the website if the original site takes more than a set amount of time.If heavy traffic causes the original site to take more than 10 seconds to load I want the visitor automatically redirected to a copy on a different server.Can this be done somehow? I'm thinking the requests might have to go through a first server that times the two other servers and decides which is the best route.Any ideas?Thanks,

Share this post


Link to post
Share on other sites

How about inserting a redirect script in 403 error page? You can insert a 10 second delay (less than 10 or zero delay) in your customized 403 error page that will redirect the traffic to your set URL.Tools involved:editing your own 403 HTML fileediting your .htaccess file

Notice from BuffaloHELP:
Nope never mind. I just realized the error in my logic. And it's not what you requested.
Edited by BuffaloHELP (see edit history)

Share this post


Link to post
Share on other sites

yes, you can do that. you will have to setup your domain to point to a server that is outside of florida and then have that page run a script that pings your "mirror" servers and then redirect to the mirror with the quickest ping time.

 

if the server is down, you will not get a response. But you might have to set the timeout to something like 500ms because you dont want people to be waiting for your site to load.

 

I did a quick google on php ping and found a script from hotscripts that can ping a server to tell if it is online or offline.

 

http://www.hotscripts.com/category/scripts/php/scripts-programs/networking-tools/ping/

 

Once you know if it is online or offline, then all you have to do is redirect to the one with lowest ping that is online.

Share this post


Link to post
Share on other sites

the problem with all this is that you have to go through a server before it checks if the other servers are down, i.e. if the redirecting server crashes, then you're no better off than before!I thought the idea of Buffalohelp's 403 error redirect script was brilliant... but then i read the comment that says it doesn't work (if anyone is wondering why, it's because for a 403 error page to get to the user, the server needs to generate a 403 page. If the server's down, this won't occur.)I think the only way to do it would be to involve the DNS (Domain Names Server). However, I don't think you can do it this way.I guess the easiest solution is to put on your main website a link to the mirror so people knew the link to the mirror if the main site was down.I'm not sure if this would work, but it's an idea:When the web page can't be found, the browser checks the Temporary Internet Files to see if it can find a file there (I think. You'd want to check this). Maybe you could make it so that each page on your site automatically checks if your site is up... then, when the Temporary Internet Files version was loaded, it would check to see if your site was up, realise it isn't, and redirect accordingly. This would only work if the user had previously visited your site, though.hope I've helped :Pcheers.

Share this post


Link to post
Share on other sites

U may create a mirror of your website at freeservers.com.There U must create a free subdomain.After it goto your account and click "Manage site".There U can see button "Upload from other site"... but they give free only 20 Mb space....

Share this post


Link to post
Share on other sites
This can be done if you can spend the time & money to design and implement itHow Do I Mirror A Website?Replying to DeveloperXI thought the questioner was looking for a solution that involvesA)DNS entries that can be changed in the event of a disaster like ahurricane so a request to the site will be sent to an alternate host. Ibelieve there may be a way to set up DNS to point to a list ofpotential server sites, but this is far from my areas of expertise.B)some method to allow the alternate sites to stay synchronized with the'main' site. This could be as simple as manually or by schedule (daily,hourly, minute) dumping all the content from site A to standby copysites at different locations. This approach (the automatic one) can getcomplex and difficult to manage. It takes a lot of careful planning anddecision making about what is important, how important it is ($$$), andwhat it will cost to implement.A fully 'mirrored'disaster-ready site would actually consist of multiple sites doing theuser interactions and sharing a set of databases or files located atseveral sites. No single site is 'the site'; under "normal" use and under disaster conditions, the "site"would continue to operate pretty much the same way as long as therewere at least one 'presentation' site and one site with the db and/orfiles that are available. Modern DBs have "real time"replication mechansisms that can help with the problem, but writablefiles are a different issue --- you site should probably try to avoidthe use of any writable files and do all writing into the db.Thereis no generally useful ready made out-of-the box easy solution that Iam aware of. If you are willing to live with a somewhat degraded site... Say with a warning that there was a disaster and that this is thestandby site and it may not be entirely up to date, then this isprobably pretty do-able with some simply site copying and dnsmanipulation.-reply by Dave A

Share this post


Link to post
Share on other sites

After the last batch of hurricanes we lost 5 days of traffic due to power outages in S. Florida.
What I really want to do is redirect a visitor to a copy of the website if the original site takes more than a set amount of time.
If heavy traffic causes the original site to take more than 10 seconds to load I want the visitor automatically redirected to a copy on a different server.

Can this be done somehow? I'm thinking the requests might have to go through a first server that times the two other servers and decides which is the best route.

Any ideas?
Thanks,



Hi!

I'm guessing you want to install a script on your website that re-directs the user to another server. The problem that is apparent is that if your web server is down, the user would not be able to get to the script.

However, you can have a small amount of space on a managed hosting provider and host stuff like videos and other bandwidth intensive stuff on your own web server. You can then have a script on the managed provider that checks for connectivity to your web server; if it is inaccessible then it can redirect the user to another web server. To mirror your data, you could have a cron job to run a shell script or something similar that can ZIP your files, while a shell script on the other server can download them via FTP and copy them to it's own document folder. For MySQL, you might be able to setup replication using a 3rd party solution or, alternatively, you could write your own script to synchronize the data.

Regards,
Nitin

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.