[CentOS] server mirroring how to

Mon Aug 3 14:33:03 UTC 2009
Filipe Brandenburger <filbranden at gmail.com>

Hi,

2009/8/1 fabian <fabian at baladia.gov.kw>:
> Centos 5.0 server which is used as a

If it really is 5.0, I suggest you schedule a maintenance window to
apply all the security updates, you should be running the latest
release which is 5.3 and apply updates regularly. If you don't, your
server might be vulnerable to known exploits.

> i am jus googling arround for a solution in where i could have online
> mirroring of another machine

DRBD seems to be the way to go for you. Just make sure you do your
tests in a separate environment, and do benchmarks to see if the I/O
performance you get is enough for your needs, as DRBD may have some
impact on that.

You should look into storing your mailboxes on the DRBD volume, most
of the others (DNS, password database, etc.) have their own ways of
replication, and the mail queue should be almost empty at most times,
and if it's not empty it is usually acceptable to delay the e-mails on
the queue until you can recover that box.

> i could have an identical hardware machine which could be running online
> so if the first machine fails the second one is avaliable instantly

Heartbeat is what you want to use to test if the other node is alive
and switch the services to the secondary once the primary dies.

I suggest you go with an active-passive setup, where the filesystem is
not mounted and the services are stopped on the second node (backup
node). Then you set up a heartbeat script to mount the filesystem,
start the services, and switch the virtual IP to that machine when the
other one dies.

> also if i create a new user or a new mail user ther user is replicated on
> both machine

Are you talking about Unix users? I believe so... In that case, I
suggest you set up an LDAP database (OpenLDAP should be enough for
your needs) and set up LDAP replication. You can do that on the same
nodes you are using for all the other services. Then configure NSS and
PAM to have all your services use the user database and authenticate
passwords to those LDAP servers. Set your first node as a master LDAP
database (read-write), and your second node as a replica of that one
(read-only). If your first node goes down, you will be unable to
create new users or change passwords, but that is generally acceptable
in a degraded situation.

> if i upgraded or install any software on one machine it is replicated on
> the other automaticalu..

No, that will not be done with DRBD/Heartbeat, and I don't really
think you'd want that, otherwise a bad upgrade or a bad command would
kill both your master and your backup. The situation where both your
machines are managed independently is much better in that sense, as
long as you are organized to manage them.

HTH,
Filipe