Seunghyun. Cho wrote:
I am running apache/php and Mysql on my gentoo server. I just backup
tar copies everyday. When the system is down, it is very difficult
to recover it. So I'd like to make automatic backup(or load
ballancing) system for my site.
How can I implement this on gentoo machine. One is main web&db
server. and there is second server sync data in real time. When main
server is down, second server should do the job of main server. And
data needs to be backuped in realtime(or everyday... real time
syncing is much better~)
Is anybody implemeted this? Give me some ideas...
You've got a few options depending on how much money you have.
1. No shared storage
Setup a cron to rsync your Apache dir every X minutes to your second
machine. Assuming you're not changing content that often, it would be
easier if you had your dev machine, assuming you use one, sync to both
servers whenever you push content live. Running frequent rsyncs over
large data sets can bog your server down.
Mysql replication is incredibly simple these days as long as you're
doing it in one direction. Probably take you 30 minute total to set it
up. The hard part is switching back to the primary. You don't want that
to happen automatically since the primary will not have the latest data.
Do some reading on this as you'll really need to know what going on.
Run HA scripts or daemons, etc on the two servers. There are a number
of packages around that do some simple heartbeat stuff. Again some
reading as which one you chooses affects what you can do.
2. Shared storage
This requires some significant cash. You hook both servers up to a
happy little RAID 5 array. All data is stored on the array. Run your
heartbeat scripts and you're pretty much set. You'll need to do a bit
more reading about Mysql as you'll NEVER want both Mysql's trying to
update the data at the same time.
And now the caveats. If you are allowing users to upload pictures and
content that doesn't get jammed into the db, doing the first solution is
going to suck as you'll need to push the content around pretty quick.
Also in the second solution if your storage goes down, you are
completely down. HA scripts can get a little funky sometimes. Make sure
you're on a switch, with normal ether cards, and have mature drivers.
This will go a long way towards making things more stable. Lastly you
can always spend a lot more money then this with hardware load
balancers, storage with multiple heads, dedicated db servers, etc, but
these two options seemed to be closer to what you were looking for.
kashani
--
gentoo-user@gentoo.org mailing list