Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
mirroring a webserver
#1

hi guys, i'd like to (if possible) mirror my webserver setup (centos 5.5) so that it's running simultaneously on one server in Europe and one in the U.S. and any changes that happen on one will be mirrored on the other

 

the setup is all via rpm, and it's apache, mysql, php, there are two websites with databases to consider (this and another) and that's about it,

is it doable but more importantly is it hard to do ??? any tips/ideas/guides ?

Reply
#2

Quote:hi guys, i'd like to (if possible) mirror my webserver setup (centos 5.5) so that it's running simultaneously on one server in Europe and one in the U.S. and any changes that happen on one will be mirrored on the other

 

the setup is all via rpm, and it's apache, mysql, php, there are two websites with databases to consider (this and another) and that's about it,

is it doable but more importantly is it hard to do ??? any tips/ideas/guides ?
 

When you say, 'the setup', do you mean the software configuration, the website data, or both?

 

I'd imagine that doing the website data would be fairly easy (something like this?), but I'm not sure exactly what would be involved with mirroring the software configuration too.

Reply
#3

that looks like what i need, thanks Peter,

 

basically if i can setup the box myself then rsync can do the rest, i'll have to study that guide and see if i can get it to mirror the sites from the current location (amsterdam) to my home server (sweden), if that works successfully then i'll see what options are available for mirroring a box in the us

 

thanks !

Reply
#4

Quote:that looks like what i need, thanks Peter,

 

basically if i can setup the box myself then rsync can do the rest, i'll have to study that guide and see if i can get it to mirror the sites from the current location (amsterdam) to my home server (sweden), if that works successfully then i'll see what options are available for mirroring a box in the us

 

thanks !
 

I use rsync over SSH all the time -- for running off-site backups of my server, in fact.

 

If you have rsync installed on both boxes, as most Linuxes do, then you just enable SSH and set up keys, you can just have something like this (example ONLY!):

 



Code:
rsync -avh --delete /var/www/ -e ssh someone@remoteserver:/var/www/




 

and it will do a one-way sync from the local machine in this case to the remote machine. Other things to consider are obviously the database, but I'm sure it would be possible one-way with a mysqldump, scp, and automated restore at the other end.

 

This is all off the top of my head, and is focused around one-way pushing data as a backup, as I've said, something like Unison may be better for bidirectional sync.

Reply
#5

hmm so are you saying rsync wouldn't manage the databases ? what i ideally want is (for example) if a post is made on one mirror, that the mirror site (the other one) will show/reflect that change in a period of time (say, one hour or something) ?

 

as there are databases involved is this doable ? have you ever tried it on a live database ?

Reply
#6

Quote:hmm so are you saying rsync wouldn't manage the databases ? what i ideally want is (for example) if a post is made on one mirror, that the mirror site (the other one) will show/reflect that change in a period of time (say, one hour or something) ?

 

as there are databases involved is this doable ? have you ever tried it on a live database ?
 

I think that corruption issues can happen when you deal with the MySQL database files directly, that's why mysqldump and restoring was what I suggested.

 

The other option is to do MySQL replication, but that seems to be much more complicated and isn't something I have at all tried.

 

I imagine that you might be able to do mysqldump and an automated restore at the other end every hour or so, though. Again, it's only a one-way process, not a bidirectional sync, but it could act as a 'live' backup.

Reply
#7

Are you trying to run a mirror server so that if there are any failures on one you can immediately cut over to the other (create a live backup server for failover)?

 

Or are you looking at trying to have both available to provide some kind of load balancing/clustering with a DNS record that points to both?

 

Just curious. I would go down the "have a primary server and rsync over to the secondary" route myself (as I have done with some servers) but I'm aware that it's not a bidirectional sync - that gives rise to race conditions and deadlocks if both servers are of peer priority.

Reply
#8

it's for a variety of reasons, backup is one, also having a server available in the us is another, it doesn't have to be an instant copy and i assume that one will be the master and the other the slave, or am i thinking wrong ? i'm just investigating this, not totally sure if i'll do it.

 

cheers

niall

Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)