LAMP in High Availability cluster

Issues related to applications and software problems
Post Reply
User avatar
luigidangelo
Posts: 7
Joined: 2017/12/10 10:38:41
Location: Rome, Italy

LAMP in High Availability cluster

Post by luigidangelo » 2018/03/09 16:44:43

Hello.
During the last weeks i managed to set up a mediawiki on a CentOS 7 server which now is up and running.

My next step would be to set up an active/passive cluster to have a more secure availability of the documents to be put on the mediawiki.
I've found a lot of documentation on the web, and now I have a basic cluster (made by virtual machines by now, just for testing) with a virtual IP addres, a replicated /var/www/html directory via DRBD and an httpd service.

I would need help for a few more things:
how do I exactly set up a whole LAMP in HighAvailability (httpd mysqld php)?
1. I guess i'll have to duplicate the /var/lib/mysql directory via DRBD (the whole directory or just the database directory?)
2. Do I simply install php on both the cluster servers without the need to set php as a resource in the cluster?
3. i'll have to adjust the commands to duplicate the httpd service to have a duplicated mysql service too.

Sorry but the tutorials I found about this are not as clear as the ones about a "simple" web server cluster

User avatar
TrevorH
Site Admin
Posts: 33215
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: LAMP in High Availability cluster

Post by TrevorH » 2018/03/09 17:38:40

1. I guess i'll have to duplicate the /var/lib/mysql directory via DRBD (the whole directory or just the database directory?)
Probably easier to set up mysql replication and a floating ip address that sits on the active system.
2. Do I simply install php on both the cluster servers without the need to set php as a resource in the cluster?
Your resource is your httpd server. It will need all the packages available to it that it needs to run your web pages. If you use php via php-fpm then, yes, you need to make that a resource too.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

User avatar
luigidangelo
Posts: 7
Joined: 2017/12/10 10:38:41
Location: Rome, Italy

Re: LAMP in High Availability cluster

Post by luigidangelo » 2018/03/20 05:23:39

Probably easier to set up mysql replication and a floating ip address that sits on the active system.
With this setup, in case of a server failure, will the passage to the secondary server be "transparent" for the users? Will the LAMP keep on working?

hunter86_bg
Posts: 2019
Joined: 2015/02/17 15:14:33
Location: Bulgaria
Contact:

Re: LAMP in High Availability cluster

Post by hunter86_bg » 2018/03/22 22:44:43

luigidangelo wrote:
Probably easier to set up mysql replication and a floating ip address that sits on the active system.
With this setup, in case of a server failure, will the passage to the secondary server be "transparent" for the users? Will the LAMP keep on working?
I guess that some of the clients will loose connection and will need to login to the fail-over apache, but the service will be restored.

I'd prefer to setup a MySQL/MariaDB replication (or Galera Cluster) with apache on each node. The systemd service should contain 'Restart=Always' stanza.

Also you can use the cluster to control your Floating IP and your Load Balancer (for example HAProxy , but you need to play a little bit to make your HAProxy smarter so you won't forward requests to a dead server) which will load balance between the apaches and thus use both apache servers instead of 1.

You have plenty of options, but they need to be reviewed according to your needs.

Post Reply