...making Linux just a little more fun!
(?) The Answer Gang (!)
By Jim Dennis, Ben Okopnik, Dan Wilder, Breen, Chris, and... (meet the Gang) ... the Editors of Linux Gazette... and You!

We have guidelines for asking and answering questions. Linux questions only, please.
We make no guarantees about answers, but you can be anonymous on request.
See also: The Answer Gang's Knowledge Base and the LG Search Engine

(?) Mirror 2 web servers

From Bradley Chapman, Thomas Adam, John Karns, Ben Okopnik

Hi folks at ,The Answer Gang

I have two webservers running linux (redhat) one of them is the primary server and the other one acts as backup

the thing is that i want to be able to mirror these servers in both ways

including this:

(!) [Bradley] Well, since you're using a MySQL database, have you considered moving the MySQL database and DBMS onto a third machine which is more powerful than the two webservers, and simply having the webservers query the database using your favorite RDBMS protocol. Or you could use the MySQL mirroring and load balancing features (Google turns up a lot of links).
Many online websites, such as discussion forums, often place the DB onto a separate machine and the Web server software onto another one (or two, or any value of N), and use DNS round robin to rotate amongst the Web servers, thus lessening the risk that a single machine failure will kill the site.

(?) i was thinking a shell script would do the trick! but my competence ends just after #!/bin/bash!

i am not asking for a complete script

just some were to turn for help :)

(!) [Bradley] You can help us by supplying ASCII art defining your network topology - the really smart people who know DBs and stuff on this list will probably need it ;-)
(!) [Thomas] Have a look at the 'rsync' utility -- that will fit your needs quite happily.
(!) [John] Just thought I'd mention a few general suggestions.
To read up on bash scripting, you might want to take a look at the "advanced bash scripting guide" at one of the following URL's.


Linux Documentation Project:
Postscript --
Text --
Author's home page: [ 624k ] (bzip2-ed tarball containing SGML source, all example scripts, and rendered HTML)


"man bash" at the command prompt will yield the extensive bash man page, assuming that you have it available on your system.
Also, there are some articles on the subject in the archives of the Linux Gazette, some of which were authored by Ben Okopnik, one of the members of the answer gang.
(!) [Ben] Yep. Just search for "shell scripting" (including the double-quotes) at <>; and you'll see it right at the top of the stack.
(!) [John] The rsync utility is often used for mirroring and can save bandwidth. For the MySQL side of it, you may need to get a bit more creative. I would suggest fishing around on the 'net for DB mirroring with MySQL, as I think rsync is intended more as a tool to deal with plain ASCII files, although I could be off on that.
(!) [Ben] [grin] Just a little, John. "rsync" is intended for file transfer in general, no restriction as to type. I use it with the "-e ssh" option (actually, I have "RSYNC_RSH=/usr/bin/ssh" set in my "~/.bash_profile"), so it uses SSH as the underlying mechanism, but "rsh", although deprecated in most situations, is also type-independent (although it's somewhat clunky - the STDIN/STDOUT method of transferring data does make it look like a text-specific gadget.)

This page edited and maintained by the Editors of Linux Gazette
Copyright © its authors, 2004
Published in issue 101 of Linux Gazette April 2004
HTML script maintained by Heather Stern of Starshine Technical Services,

[ Table Of Contents ][ Answer Guy Current Index ] greetings   Meet the Gang   1   2   3   4   5   6   7 [ Index of Past Answers ]