This webcast covers the theoretical introduction to Web Farms and how to build Drupal Web Farms with IIS. Don't miss the second part of the webcast (also part of this series) where a full demo on creating Drupal Web Farms with 4 virtual machines will be presented. If you are already familiar with Web Farms, Application Request Router, Web Farm Framework you can skip to part 2. Otherwise, this webcast is highly recommended and propaedeutic to grasp all the basic knowledge that you might need later.
1. Building Drupal Web
Farms with IIS - Part 1
Alessandro Pilotti
@alexpilotti
MVP ASP.NET / IIS
MCSD, MCAD, MCSE, MCDBA, MCT
Red Hat Certified Engineer
2. Application Request Routing
2.5
IIS 7.x add-on installable via WebPI or setup available on
http://iis.NET
Features
HTTP based routing decisions
Load balance algorithms
Health monitoring
Client affinity
Host name Affinity
Multiple server groups
Managing and monitoring by using the UI
Caching
SSL offloading
Failed Request Tracing rules
3. Web Farm Framework 2.1
Features
Integration with ARR
Platform provisioning
Including frameworks (PHP, etc)
Application provisioning via WebDeploy
Simplified farm management
Rich UI for monitoring and management
5. Create a Server Farm
After installing ARR and/or WFF the node “Server
Farms” shows up in the tree
6. Server Farm
You can enable independently
Load balancing
Server farm provisioning
Enabling server farm provisioning only means that an alternative
load balancing solution is planned, e.g.:
Hardware NLB
Varnish
Apache + HAProxy
WFF requires administrator credentials valid on all the hosts
belonging to the farm
Creating an ARR farm via GUI creates also URL rewrite rules
8. WFF Server Roles
WFF is based on the concept of a primary host and multiple
secondary hosts
Primary host
Is the master
Platform and applications get provisioned to secondary hosts
Secondary hosts
Are “clones” of the primary host
Roles can be switched
A secondary host can become primary
Provisioning is customizable
29. Analyze Traces
Traces are located by default in
%SystemDrive%inetpubLogsFailedReqLogFiles
Sections to check:
GENERAL_REQUEST_HEADERS
ARR_REQUEST_ROUTED
ARR_SERVER_STATS
GENERAL_RESPONSE_HEADERS
GENERAL_RESPONSE_ENTITY_BUFFER
30. CLI
To obtain what we did via GUI:
appcmd set site "Default Web Site" -
traceFailedRequestsLogging.enabled:"true" /commit:apphost
appcmd.exe set config "Default Web Site" -
section:system.webServer/tracing/traceFailedRequests
/+"[path='*']”
appcmd.exe set config "Default Web Site" -
section:system.webServer/tracing/traceFailedRequests
/+"[path='*'].traceAreas.[provider='WWW
Server',areas='Rewrite,RequestRouting',verbosity='Verbose']”
appcmd.exe set config "Default Web Site" -
section:system.webServer/tracing/traceFailedRequests
/[path='*'].failureDefinitions.statusCodes:"200-399"
31. Shared Config
Share the same IIS server configuration among two or
more hosts
Obtained by saving the configuration files on a network
share
An encryption key is set to protect sensitive data
Web sites reside on shared paths
36. Roles
Load balancer / Farm controller (DrupalARR)
Web Server 1 (DrupalWeb1)
Web Server 2 (DrupalWeb2)
File Server (DrupalFileServer)
MySQL Server (DrupalDB)
Note: In our demo and lab, we will install MySQL on DrupalFileServer
to limit the number of required VMs
37. DBMS
Install MySQL on the DBMS server
Can be Windows, Linux, etc
CREATE DATABASE MyNewDrupalSite2;
Enable access to the MySQL database from the web
servers. E.g.:
CREATE USER 'MyNewDrupalSite2'@'%' IDENTIFIED BY
'Passw0rd';
GRANT ALL On MyNewDrupalSite2.* TO
'MyNewDrupalSite2'@'%’;
Note: in the Drupal web apps, connecting to MySQL using
an IP address is preferred
Avoid name resolution
38. Web Farm Hosts
Web farm hosts (DrupalWeb1 and
DrupalWeb2)
Install Web Deploy via WebPI, if not already
installed
Disable UAC (User Account Control)
Enable the following feature through the local
firewall
Core Networking
File And Printer Sharing
Remote Administration
39. Web Farm Hosts
We need a common account with administrator rights
on the hosts. It can be:
A domain user
A user with same username/password on all hosts
Must be a member of the “Administrators” group
Check that the user password is not set to expire
net user wfadmin Passw0rd /add
wmic path Win32_UserAccount where
Name='wfadmin' set PasswordExpires=false
net localgroup administrators wfadmin /add
40. Drupal Web Site
Create a Drupal web site on the primary server
(DrupalWeb1)
Via WebPI or manually
As seen in the previous lessons
Install all necessary components
PHP 5.3, PHP Manager, WinCache, URL Rewrite
Point the Drupal DB configuration to the database on the
DBMS server
For performance reasons, consider using an IP address
instead of name resolution
WFF will later use WebDeploy to replicate the site to
the secondary servers (DrupalWeb2 in our case)
42. ARR
Open IIS Manager and create Web Farm.
Note: if IIS Manager was open during the setup of ARR, it
needs to be closed and reopened to be able to access
the installed features.
44. Add Primary Host to the Farm
In our case, DrupalWeb1 will become the primary
server
This host contains the Drupal web site(s) to be served
by the farm (can be added later)
46. URL Rewrite Rules
Create local URL Rewrite rules. This is the base of the
redirection process!
47. Platform Provisioning
At this point, platform and application synchronization
between the hosts takes place.
Platform tools and frameworks that are available on the
primary server get installed on the other servers.
Afterwards, application pools, sites and applications will
be synchronized
Provisoning can be started manually
Check secondary web farm hosts afterwards
51. ARR – Set Affinity Cookie
Note: a distributed session management should
also be evaluated.
52. The “drupalwp” User
Create a common user on:
DrupalFileServer
DrupalWeb1
DrupalWeb2
No privileges required
net user drupalwp Passw0rd /add
wmic path Win32_UserAccount where
Name=’drupalwp' set PasswordExpires=false
Check that the user password is not set to expire
Repeat on all the above hosts
53. WP Identity
On the primary server, in IIS Manager, open the server
node, click on Application Pools and on the Drupal web
site application pool.
Click on “Advanced Settings…”
Change the Identity to the drupalwp user and set it to
“drupalwp”
In the PHP.ini configuration file on the PHP version
used by the Drupal web site, set
fastcgi.impersonate = 0
For performance, make sure also that WinCache is
enabled.
54. Shared Storage Access
Drupal requires a shared “files” directory accessed by the
web farm hosts
Can be hosted on a SMB share
As an alternative FS sync solutions could be applied
DFS, rsync, WebDeploy, etc
A valid user must exist on the web farm hosts and on the file
server. It can be:
A domain account
A local user with same username and password
Proper permissions need to be set on the SMB share
55. Folder Permissions
Create a directory where you want to store your Drupal
shared data
E.g: C:DataMyNewDrupalSite
Add write permissions for the user “drupalwp”
56. SMB Share
Create an SMB share for the directory and add
read/write permissions for the user “drupalwp”
58. Troubleshoot SMB Access
From the web farm hosts (DrupalWeb1, DrupalWeb2) try to access
the shared folder with the identity of the WP user:
Runas /u:drupalwp cmd
In the drupalwp command prompt:
net use drupaltest05MyNewDrupalSite
echo test > drupaltest05MyNewDrupalSitetest.txt
dir drupaltest05MyNewDrupalSite
File exists: ok
del drupaltest05MyNewDrupalSitetest.txt
59. Drupal Configuration
Log on the drupal web site as administrator and go to:
Administer -> Site Configuration -> File System
Set the “File System”, “Temp” path on the shared
storage area.
Create a separate share on the file server for the “Private”
path if necessary
61. Drupal 6 Caveat
Drupal 6.19 published on WebPI doesn’t support UNC
paths. This can be easily solved with the following code
patch:
File includes/file.inc
Line 126
Original if (!is_writable($directory)) {
Modified if (!touch($directory)) {