# Apache/MySQL Clustering

## kmj0377

What is the best way to go about this?  I've seen several topics on this but not many replies to any of them.

The services I need in the cluster are just apache and mysql for now.  Later on I may do a mail server cluster with postfix and courier-imap and if anyone has any thoughts on that subject, input is appreciated.  And I also have a LDAP box which may need clustering too and I've seen very little about that on the internet.

I'm stuck on what to use for it.  LVS and Linux-HA stuff is much talked about, but my boss doesn't like the idea of the load balancer and sees it as a single point of failure and also sees it as a waste to cluster those as well.  He's interested in wackamole, but I see very little on the internet about it as far as discussion.  Their mailing list is also very bare.

I'm also going to need 1 or more partitions to stay synced up on them.  I've looked at drdb, but AFAIK it really only supports 2 nodes.  I've tried to find info on using cluster filesystems in Gentoo, but haven't had much success.

And as far as clustering mysql, I've seen it's better to go with replication as opposed to using the ndb storage.  Is this the case?  Has anyone set up two master replication nodes in that case?  I'm not going for failover, but really two or more nodes for load balancing and high availability.

So if anyone has done any of these, could they share what they did and how it worked out?

----------

## mudrii

Try to keep it simple

Separate the servers apache from mysql run on separate servers

Mysql runs in HA very good on replication and very bad on clustering as mysql 5.0.x cluster put every thing in RAM which is bad thing if you have a big DB.

For apache HA keepalive or heartbet should do it and keep it simple as much as possible if is not a very big complex cluster you build.

Regards

----------

## kmj0377

Any recommendations for filesystems to keep the web directories and such synced up?  GFS or drdb looks like they might do what I need, but I'm not sure which to go with.

----------

## thebigslide

I put web directories on an NFS share.

----------

## kmj0377

 *thebigslide wrote:*   

> I put web directories on an NFS share.

 

Although we do have a box with RAID5 on it that could be used as a NFS share, that still creates a single point of failure.  I'm more in need of a filesystem that replicates between them.

----------

## thebigslide

rsync?

----------

## kmj0377

 *thebigslide wrote:*   

> rsync?

 

I'm going to need them synced up more than rsync can provide.  A file could be modified on any of them, so I can't have them rsyncing up to every other one.

----------

## Bad Penguin

 *kmj0377 wrote:*   

> What is the best way to go about this?  I've seen several topics on this but not many replies to any of them.
> 
> The services I need in the cluster are just apache and mysql for now.  Later on I may do a mail server cluster with postfix and courier-imap and if anyone has any thoughts on that subject, input is appreciated.  And I also have a LDAP box which may need clustering too and I've seen very little about that on the internet.

 

It really depends on why you want to cluster - failover, high availability, distributing/balancing the load, etc...

LVS is extremely easy to do when using keepalived to implement it.  One fairly simple config file to set up all of the services, it also will do hot failover between multiple LVS routers.

As far as mysql things are not as simple because you have to do replication.  You could always configure your apps to do read-only access to a specific load balanced set of servers, any writes/updates/deletes/inserts to the master...

----------

## kmj0377

 *Bad Penguin wrote:*   

>  *kmj0377 wrote:*   What is the best way to go about this?  I've seen several topics on this but not many replies to any of them.
> 
> The services I need in the cluster are just apache and mysql for now.  Later on I may do a mail server cluster with postfix and courier-imap and if anyone has any thoughts on that subject, input is appreciated.  And I also have a LDAP box which may need clustering too and I've seen very little about that on the internet. 
> 
> It really depends on why you want to cluster - failover, high availability, distributing/balancing the load, etc...
> ...

 

I'm going for high availability and load balancing.

I suppose my main problem is replicating partitions.  Right now DRBD would work for me since I only have 2 nodes, the problem comes when I want to add more and since all will be active nodes, that creates a bigger issue.

----------

## kmj0377

Just stumbled onto Fex.  It appears that could do what I need by having them import each other.  I'll also have a server possibly across the internet as a failover box through DNS round robin or something and this would work well for this since I don't have access to make the filesystem whatever I want.  Intermezzo may do what I want as well, but it seems overly complicated and a node must be explicitly set as client or server.

----------

## kmj0377

I think I've fairly well made up my mind on what to use.  Any suggestions/comments are welcome.

1.  LVS for load balancing.

2.  MySQL replication as shown in http://www.onlamp.com/pub/a/onlamp/2006/04/20/advanced-mysql-replication.html?page=1

3.  Fex for filesystem replication.

----------

## Bad Penguin

 *kmj0377 wrote:*   

> I think I've fairly well made up my mind on what to use.  Any suggestions/comments are welcome.
> 
> 1.  LVS for load balancing.
> 
> 2.  MySQL replication as shown in http://www.onlamp.com/pub/a/onlamp/2006/04/20/advanced-mysql-replication.html?page=1
> ...

 

Just curious, why the need for filesystem replication?  Why not just use normal package management to handle it?

----------

## kmj0377

 *Bad Penguin wrote:*   

>  *kmj0377 wrote:*   I think I've fairly well made up my mind on what to use.  Any suggestions/comments are welcome.
> 
> 1.  LVS for load balancing.
> 
> 2.  MySQL replication as shown in http://www.onlamp.com/pub/a/onlamp/2006/04/20/advanced-mysql-replication.html?page=1
> ...

 

It's not to handle the stuff Gentoo installs, but to keep the web directory synced.

----------

## joyo222

hi, have you heard of sequoia?

http://sequoia.continuent.org/HomePage

it's another option for clustering DB servers w/out using NDB.  I haven't used it, but we are currently looking at it as a possible solution to some of our mysql replication problems.

----------

