Installing two Moodle servers and one database server

Installing two Moodle servers and one database server

by James P -
Number of replies: 3

Hi,

I was wondering if there is a way to install two Moodle servers and run them off one database server so one server can be taken down and the other can stay up, or we run two in parallel. 

To install Moodle and the database we are using AWS Ubuntu Servers.

This is for a university assessment and our group is stuck.

Any help will be appreciated 

Thanks!

James


Average of ratings: -
In reply to James P

Re: Installing two Moodle servers and one database server

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
Hi James

Look at these parameters in config.php:
$CFG->dbhost
$CFG->dbname
$CFG->dbuser
$CFG->dbpass

In the two config.php files, dbhost will be the same, the other three parameters different.

P.S. There is another more subtle variation, if it suits better. Have all the four parameter above identical but make the fifth parameter $CFG->prefix differ.
In reply to Visvanath Ratnaweera

Re: Installing two Moodle servers and one database server

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

I don't think this is what he meant. Is this not just a "load balanced" front end that the OP wants?

Just point both Moodle instances to the same database server. The settings will be (must be!) identical. Note that they also have to share 'moodledata' (the folder pointed to by $CFG->dataroot in config.php)

They also have to have the same URL ($CFG->wwwroot). The quickest way to do that is a 'round robin' in DNS (Google it!). Although you can use a dedicated load balancer (AWS has one) if you are keen. 

Average of ratings: Useful (1)
In reply to Howard Miller

Re: Installing two Moodle servers and one database server

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
James, if those "two Moodle servers" serve the same Moodle site, same $CFG->wwwroot, then what Howard described applies, with the additional point https://docs.moodle.org/en/Session_handling. Either the two servers share the session data through the common database (more resources) or can store locally (more efficient) if your load balance is "session aware".

This topic has been discussed many times in the Hardware and performance forum. But there is no Moodle-preferred method, simply because the architecture depends on the server environment you use.