Hardware and performance

Picture of Shay Hanna
2 Web Server to One Mysql


I`m trying to setup two or more web servers (apache2 + Php5) connecting to the same Moodle Database on one MySQL Server.

Those web servers will be behind f5 load balancer hardware device.

Is it possible to achieve that several web servers will connect to the same Moodle database on one MySQL server???

If so, is there an installation guide for that topology?

I success connect one web server to Moodle database on remote MySQL server but its seems that I cannot connect another web server to the same database.

Any Ideas?



Average of ratings: -
Picture of Howard Miller
Re: 2 Web Server to One Mysql
Group DevelopersGroup Documentation writersGroup Particularly helpful Moodlers

All the config.php files should be exactly the same. That's it. There's no more to it. You need to do the same for the 'moodledata' files area too. You can connect multiple clients to the same database - that's what databases are for!!

If you are having problems we'll need to know the details of what is going wrong.

Average of ratings: -
Picture of Visvanath Ratnaweera
Re: 2 Web Server to One Mysql
Group Particularly helpful Moodlers

In addition you have to keep an eye on sessions. Either the load balancer supports sticky sessions or you delegate the session handling to the database.

Of course there is this 'moodledata' ($CFG->dataroot) to which both servers need to have access, you knew that I believe. If not, make use of the 'Advanced search' linked to the intro to this forum.

If you are new, get each server working alone, i.e. without a load balancer, and then try to couple them.

P.S. You shoule leave a note in the "Installation problems" forum https://moodle.org/mod/forum/discuss.php?d=216576 pointing to this discussion as the follow-up. Ideally that discussion should have been moved here. I know, the site moderators are reluctant to do that fearing that might upset the posters. May be this Alice quote will help: http://ebooks.adelaide.edu.au/c/carroll/lewis/alice/chapter12.html#chapter12.
Average of ratings: -
Picture of Simon Story
Re: 2 Web Server to One Mysql

The current version of Moodle defaults to storing sessions in the database.

Average of ratings: -
Picture of Simon Story
Re: 2 Web Server to One Mysql

Hello Shay,

Is there and error message? As Howard says, there is nothing special to do for the database. Perhaps you forgot to allow access to the database from the second webserver?


You need to make sure you are sharing the moodledata directory between both webservers however.

Average of ratings: -