Common Scaling Fixes for your SwitchMasterToWeb.config file

If you are scaling out your Sitecore environment, you are likely very familiar with the scaling guides available on the SDN. Along with this great documentation is also a configuration file you can download (SwitchMasterToWeb) that can be used to disable your ‘master’ database in a content delivery environment. This file contains several patch configurations which are used to remove elements that are not needed on a content delivery node or to update the default database to ‘web’ instead of ‘master.’

This is a great way to get your scaling kickstarted, but this file has a few caveats you need to know about before commenting out the ‘master’ database in your ConnectionStrings.config file.

DMS definition database

Sitecore is hard-coded to use the ‘master’ database as the default DMS definition database. If you are running DMS in your installation, you will need to ensure these definitions are pulled from the ‘web’ database on your content delivery nodes. Currently, none of the configuration files contain any settings to change this from ‘master’ to ‘web.’ If you decompile the DLLs, though, you can see that it will try to find a setting named Analytics.DefaultDefinitionDatabase.

The solution to this came to me via a Brian Pedersen blog, which provides the configuration change you need to alter the default definition database. You can edit your existing SwitchMasterToWeb.config file with the following lines to ensure DMS pulls from ‘web’:

        <!-- Forces DMS to check 'web' for definitions -->
<setting set:value="web" name="Analytics.DefaultDefinitionDatabase">

Sitecore 7 Lucene index definitions

Depending on how you are deploying your index definitions, you may have Lucene configuration files that contain indexes for both the ‘master’ and ‘web’ databases. For example, we define a ‘sitesearch’ index for both web and master which we use for a variety of listing/search pages.

If you have any indexes configured to point at the ‘master’ database in your content delivery environment, the indexing manager will begin to throw errors once you remove the ‘master’ database connection from the connectionstrings.config file. The index configuration file will no longer be able to be loaded, so it will affect all of your logic, even those not using the problematic index.

Below is an example of some lines you can add to your SwitchMasterToWeb.config file to make sure that any indexes you have defined that point to ‘master’ are removed even if the files exist.

                <index id="sitecore_master_index">
                    <patch:delete />
                <index id="sitesearch_master">
                    <patch:delete />
Sitecore 7 indexing optimizations and strategies

To further clean things up, you may want to take a look at the revised SwitchMasterToWeb.config provided by Adam Simmonds. It will show you how to remove additional indexing elements such as maintenance strategies and optimization tasks.

Have you encountered other scaling configurations that you think would be good additions to the SwitchMasterToWeb.config file?