Professional Documents
Culture Documents
Moodle on a
Windows
High
Availability
Environment
Implementing Moodle 1.9 on 2
Microsoft Load Balanced Web Front
End Server and a Microsoft SQL
Server 2008 R2 Cluster environment
Written by:
Alex Pearce
Email:
apearce@bfcnetworks.com
Blog:
www.learninggateway.net/blogs/ajp
Contents
Introduction ...................................................................................................................................... 2
Understanding the Architecture ........................................................................................................ 2
Pre-requirements .............................................................................................................................. 3
Server Network Interface Cards ..................................................................................................... 3
Domain Users ................................................................................................................................ 3
Shares on SAN ............................................................................................................................... 4
Enabling the required Features and Role ........................................................................................... 4
Connecting to a iSCSI Drive ................................................................................................................ 5
Creating the Cluster........................................................................................................................... 8
Installing SQL Server 2008 R2 as a Cluster ........................................................................................ 13
Configuring Moodle Web Front End Servers. ................................................................................... 17
Installing PHP and Configuration with IIS ......................................................................................... 19
Configuring the PHP.ini file .............................................................................................................. 21
Testing IIS and PHP .......................................................................................................................... 24
Configuring Network Load Balancing ............................................................................................... 25
Testing the Network Load Balance ................................................................................................... 28
Configuring SQL Server .................................................................................................................... 29
Download and Configuring Moodle ................................................................................................. 31
Moving Moodle to be Network Load Balanced ................................................................................ 35
Configuring IIS for remote Moodle files. .......................................................................................... 36
1|P a ge
Students are using the internet every day and all days and will learn better when it suits them,
teaching in the classroom between 9 and 3 is not where it ends as they log into web pages and
extend their learning when they want.
What happens if the single online learning server goes down and the students can’t learn? They lose
confidence in the technology and are denied the education they want. But technologies from
Microsoft have allowed websites to stay accessible through their high availability products and
features.
Windows Server 2008 R2 Enterprise includes the role Microsoft Clustering. In this scenario we are
using the Active/Passive setting which means one server is currently the live server running the
database services while the Passive server is set in standby waiting in case the other server fails. If it
does fail, the passive server will take control of the database services enabling the database to be
online again. This server will then become the active Node. In this whitepaper we will be using 1
Active and 1 Passive but you may want to increase the number of nodes if you require.
Windows Storage Server 2008 allows large amount of data to be stored on a specially designed
storage server which will have a large number of physical hard drives. This technology has been
developed to house data in a central location instead of on multiple servers.
We will be using the Windows Storage Server to house the SQL database and the files required to
run the website.
In this environment we are using virtual servers but depending on your requirements and database
read/write speeds you may want to use physical SQL Servers in your cluster.
The two web front end servers will convert the Moodle PHP files to a website. These two servers
will be Network Load Balanced (NLB) allowing one server to be down and the other to still present
the website. When both servers are online users will connect to both but should one fail the other
will take the load.
2|P a ge
Pre-requirements
There are a few requirements that are needed through the process of the whitepaper. Ensure you
have the following configured before starting any of the other requests.
On top of this you will require four other static IP addresses that will be added to the SQL Cluster
and the Network Load Balance settings.
Domain Users
By default Active Directory will create an administrator username. If you don’t have access to this
you will need permission to add and remove features on your servers. Ensure you have the correct
administrative permissions to the box. You will also require two other usernames md_admin and
SQLServices which should both be Active Directory accounts. They too will require administrative
permission to the servers in this whitepaper.
3|P a ge
When you have built the server add it to your Active Directory domain, logon to the server with
administrator rights so we can start enabling features and roles.
Note:
This document will not cover the ports that need to be opened on the Windows Firewall.
1. Open Server Manager and navigate down to Security Information. On the panel of the left
hand side you will find Go to Windows Firewall.
2. Navigate down to Firewall Information and on each tab (Domain, Private and Public) turn
Firewall State to Off.
3. Back in the Security Information click on Configure IE ESC and turn this Off for both
Administrators and Users.
4|P a ge
5. Ensure .NET Framework 3.5.1 is checked and also check Incoming Remote Transactions and
Outgoing Remote Transactions.
6. Click Next and complete the install of these feature by clicking on Finish.
7. In Server Manager, Click on Add Feature and check Failover Cluster. Click Next.
5|P a ge
3. The iSCSI Initiator will go to the SAN and find all the drives required. You will now see the
four drives targets you can connect to.
4. Click on each of the targets and click Connect. In the status column it will change from
Inactive to Connected. Click Done.
6|P a ge
6. Right click on each of these Offline drives and click Online. They will now say they are Not
Initialized. Right click one of the drives and click on Initialize Disk.
7. Ensure that Disk 1 to Disk 4 are checked in the windows and click on OK.
7|P a ge
1. Ensure both machines are turned on and can connect to the iSCSI drive. On node1 open
Server Manager and expand Features until you can see Failover Cluster Manager. Click on
Failover Cluster Manager.
3. A new wizard will open and it will give you more information on what is going to happen
next. We want to ensure that the hardware and software configured can be used as a full
cluster. This validation wizard will do this for us. Click Next.
8|P a ge
5. We want to run all the tests that are available on these servers so ensure that it can be a
complete cluster. Ensure Run all tests is checked and click Next.
6. You will then be given a list of tests that will run on each of the two nodes. Review the list
so you are aware of the test. Click Next to start the tests.
While the tests are running you will be able to scroll up and down the page to see which
tests have passed and failed. Do not worry if you miss a failed test as the error will be
presented on the next page. Some tests will take longer than others depending on the
number of drives and nodes in the cluster.
7. When the tests have finished it will generate a web page report. In the report you will see
which tests have failed and passed (marked as Successful). If you have received any errors,
check the report and check your hardware and software settings.
9|P a ge
9. Add the computers names of two nodes into the wizard. All these servers will be in your
cluster nodes.
10. During the pre-requirements we stated that a DNS entry will be required on your DNS
server. Now enter the NetBios name into the Cluster Name field and the static IP address in
the Address field.
When you have clicked Next the wizard will run a validation test. You will now be presented
with a Confirmation page.
11. Click Next. The wizard will now run to create your cluster. Once this is done you will get a
status at the top of the page which will say “You have successfully completed the Create
Cluster Wizard”.
10 | P a g e
12. Ensure both nodes are powered on. Complete the next steps on your Active node.
13. On the Active node open Server Manager and expand Features until you can see Failover
Cluster Manager. Click on Failover Cluster Manager.
14. Right click on Services and Applications and click on Configure a Service or Application.
15. In the list you will see several cluster applications that can be used in a Microsoft cluster.
You must ensure that these features are installed on all the nodes should you chose to use
them. Select Distributed Transaction Coordinator (DTC) and click Next.
11 | P a g e
17. Select the Cluster disk that you have created for the MSDTC and click Next. This will now
finish the application installation.
12 | P a g e
4. On the right hand side now click on New SQL Server failover cluster Installation.
5. A dependency check will now run in the background to ensure you have all the required
features installed. Once these checks have completed click on OK.
6. Add your SQL Server product key and click on Next to install the Setup Support Files.
7. Install the following Features
a. Database Engine Services
i. SQL Server Replication
ii. Full-Text Search
b. Management Tools – Basic
i. Management Tools – Complete
13 | P a g e
9. As we are using both the drives, 1 for the database and the other for the SQL logging we
need to check both of the disks. This will allow you to use both disks in this SQL Cluster.
10. The SQL cluster will use a new IP Address. We can now set this IP on the next page.
Uncheck DHCP and add the IP Address for this cluster name.
11. The SQL Server Agent and SQL Server Database Engine services will run as a domain user.
This username was created in the pre-requirements. Click Use the same account for all SQL
Server services and add the SQLServices username and password. Click Next.
1. On the next page (Database Engine Configuration) on the Account Provisioning tab click
Mixed Mode and enter a secure password. Then click on Add Current User for Specify SQL
Server Administrator and click on Data Directories.
14 | P a g e
13. Review the Installations Rules and click Install to install SQL Server Clustering to this node.
14. Once the install has finished the installation wizard will state that it is complete and you can
click Close to finish the work required on this node.
We are now going to install SQL on the other nodes within the SQL Cluster.
1. Log onto the Passive node and insert the SQL Server 2008 R2 installation Disk.
15 | P a g e
3. When the setup files have been installed you will be taken to the Cluster Node Configuration
page where it will auto detect the SQL Server instance name. Check these settings and click
Next.
4. To ensure you have the correct security permissions you are required to put in the password
for the SQL Service accounts we are using. Type the passwords in both boxes.
5. You will not be able to change any other settings so click Next until you have finished the
install of the cluster node.
16 | P a g e
2. Navigate down to Firewall Information and on each tab (Domain, Private and Public) turn
Firewall State to Off.
3. Back in the Security Information click on Configure IE ESC and turn this off for both
Administrators and Users
4. We will be using Microsoft Internet Information Service to publish our Moodle website. We
will now install this role and add the requirements needed. In Server Manager, Click on Add
Roles and check Application Server and Web Server (IIS).
17 | P a g e
6. Click Next and then Install. This will finish off the roles required, you will not require a
reboot following the install.
7. In Server Manager, Click on Add Feature and check Network Load Balancing.
8. Click Next and then Install. This will finish off the features required, you will not require a
reboot following the install.
9. Complete this on all your web front end servers.
18 | P a g e
19 | P a g e
10. Now open MIME Type from the IIS Group in IIS Manager
11. Click on Add which is located down the right hand side.
a. File Name Extension: .php
b. MIME Type: text/html
20 | P a g e
13. Remove all the default files in the list by selecting each one and clicking on Remove which is
located down the right hand side. Once you have done this click on Add.. and add index.php
as this is the default file used in Moodle when we navigate to the root of the website.
1. Open the file C:\php\php.ini in notepad and start a search in the file. You will find a whole
list of extensions one after each other. All these extensions are dll files that are stored in the
c:\php\ext folder. Moodle will not require all of these but we need to remove the comment
sign ( ; ) from each we need.
2. Remove the ; from the start of the following
a. extension=php_curl.dll
b. extension=php_gd2.dll
c. extension=php_ldap.dll
d. extension=php_mbstring.dll
e. extension=php_openssl.dll
f. extension=php_xmlrpc.dll
21 | P a g e
4. Navigate to the top of the file and search for doc_root. After the = add the root of your
website, c:\inetpub\wwwroot\
5. Even though PHP is registering correctly with the extensions we need to tell the php.ini
where the extensions folder is. Now search for extension_dir and edit this to c:\php\ext\
6. When we were installing PHP we created the folder called sessions. We now need to tell
PHP where this folder is located. Search for ;session.save_path. Note this has been
commented out. Remove the ; and change the location to c:\php\sessions. Save the
php.ini file.
For Moodle to run with a SQL Server we require a conf file to be stored in the root of the c:\ drive.
22 | P a g e
[global]
host = SQLClusterServ
port = 1433
client charset = UTF-8
tds version = 7.0
text size = 20971520s
23 | P a g e
<html>
<head>
<title>PHP test</title>
</head>
<body>
<?php
phpinfo();
?>
</body>
</html>
4. Save the file and open Internet Explorer on the Moodle server. Navigate to
http://127.0.0.1/testphp.php. If you have configured PHP correctly with Internet
Information Servers your page will load and at the top you will have the title of PHP Version
5.2.5 (x64) and look similar to the screenshot below.
24 | P a g e
We also need to test the load balancing is working so we will use the testphp.php file to do this.
1. On the first web front end server, go to Start, Administrative Tools and click on Network
Load Balancing Manager.
2. When the manager console opens right click on Network Load Balancing Clusters and click
on New Cluster.
3. The New Cluster wizard will open and we are going to connect to the first host in the Load
Balancing cluster. This is the machine you are currently on. Type in the computer name of
the machine you are currently connected to and click on Connect.
25 | P a g e
5. We do not need to change any of the settings on the next page. Click Next.
6. We now need to add the IP address for the NLB Cluster. Click on Add and type in the IP
Address and Subnet Mask. Click OK and then Next.
7. In the Cluster operation mode select Multicast and click Next and then Finish.
8. Back in the Network Load Balancing Manager the cluster will be created. You can check the
status in the log files at the bottom of the window. When this is complete you will see the
cluster IP address down the left hand side and the first machine in the NLB Cluster.
26 | P a g e
10. A similar wizard will now be open. Add the second Moodle web front end into the host
prompt box and click Connect. Select the NLB interface from the list. Click Next and run
through the wizard using the default settings.
11. Once you have clicked Finish the NLB Cluster will add the second web front end. In the list
you will now see two machines.
12. As we can see from the image above the image next to each machine name is green. If
either of these changes to red, there is an issue with that network load balanced machine.
27 | P a g e
For these tests to work we need to use a 3rd machine to test the configuration of the network load
balance.
3. Shutdown the server that is listed in the testphp file. We are now going to see if the load
balance works by disconnecting that machine and trying to connect to the other machine.
4. When the server has shutdown, connect to the same address. http://moodle/testphp.php
and check the System field. You should now see it is the other web front end server.
5. Turn the first web front end back on and shutdown the second. We are going to test that
the network load balance works on just the first web front end.
6. Open http://moodle/testphp.php and check the System field again and it reflects the
machine that is currently on.
7. If all these tests been successful, the network load balancing is working.
28 | P a g e
1. Open SQL Server Management Studio from one of the SQL Cluster Nodes. You are
connecting to the SQL Cluster name that we configured during the SQL install..
2. Create a new SQL User by expanding the Object Explorer and then expanding Logins. Click
on Logins and click New Login
29 | P a g e
6.
Now click on Options down the left hand side.
7. In the Other option section at the bottom of the page you will see a group of settings under
the Miscellaneous Group. Change ANSI NULLS Enabled to True and Quoted Identifiers
Enabled to True and click OK to create the database.
30 | P a g e
31 | P a g e
9. Complete the next form with the following settings, ensuring you have the correct settings.
a. Type: SQL Server with UTF-8 Support (MSSQL_n)
b. HostServer (Location of your SQL Server: SQLClusterServ
c. Database (Name of the database we created earlier): moodle_db
d. User (Name of the username we created earlier): moodle_user
e. Password (the password you gave to this user): ********
f. Tables prefix (Keep as default): mdl_
g. Click Next
10. You will now get a Configuration Completed that also states that config.php has been
successfully created.
32 | P a g e
Note:
This is because the user that is running the website in IIS does not have write permission to
the root of the moodle website (C:\inetpub\wwwroot\). The default user is IIS is normally
iusr_*hostname*. You do not need to change the permissions on the folder
12. Download the config.php file and save it into the root of the Moodle website,
c:\inetpub\wwwroot\ and click on continue.
13. Agree to the terms and conditions and you will be prompted if you would like Unattended
operation. Following this step Moodle will go to your database and create all the tables it
requires. If you check Unattended each script will go away and run without you having to do
anything. If you do not check this option you will have to click next after each script. There
are about 12 scripts in total. When ready, click Continue.
Note:
If you have checked Unattended do not click Continue while the scripts are running. After
about 5 seconds the page will run the next script.
33 | P a g e
You have required fields that need completing, marked in red. Fill this form in for the admin
account, remembering your admin password. The password you fill in must have at least 1
upper case character, a number and a symbol.
15. You are now on the last step of completing your Moodle install. Fill in the Front Page
settings. This will include site name, export methods, anti-virus settings and email settings.
34 | P a g e
35 | P a g e
2. Expand the connection panel until you see Default Web Site.
4. Change Physical Path to the share on the SAN we created in the pre-requirements.
5. Below Physical Path click on Physical Path Credentials and click the box with the three full
stops.
6. Click on Specific User and then Set. Type in the md_admin username that has write
permission to this share.
36 | P a g e
10. Copy the file c:\php\php.ini to c:\windows. You will be asked if you want to overwrite this
file which you need to accept.
11. Copy the file c:\inetpub\wwwroot\testphp.php to \\san\moodle.
12. To test the php is working with this new physical path on this server. Navigate to
http://127.0.0.1/testphp.php.
13. When the test page has loaded, using the search facility in your web browser search for
PATH_TRANSLATED. This will tell you the physical path of testphp.php file we have just
configured.
This has now completed the installation of Moodle on two web front ends using a Microsoft SQL
Cluster as a database service.
If you wish to test any of servers and the high availability, shutdown different servers but remember
you must have at least one web front end and one active cluster node for the Moodle website to
work.
37 | P a g e