SwitchMasterToWeb – updated for content search & analytics

A couple of weeks ago I was tasked with setting up our UAT environment, in doing so, I duly dug out the latest copy of the Scaling Guide for the appropriate version of Sitecore, and of course, dug out the trusty SwitchMasterToWeb.config.

So, some hours later, I pushed all the necessary code for our UAT content management and content delivery servers. I was disappointed to find that our indexing was not being built on the content delivery nodes. I eventually tracked it down and found that it appears to be the index update strategy. After patching it out

My Complete File

So here is my version of the switch master to web configuration

<?xml version="1.0" encoding="utf-8" ?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:set="http://www.sitecore.net/xmlconfig/set/">
  <sitecore>
    <settings>
      <setting name="Analytics.DefaultDefinitionDatabase" value=“pub“ />
    </settings>
    <sites>
      <!-- OPTIONAL FOR CHANGING TO PUB DB -->
      <site name="shell" set:content="pub" />
      <site name="modules_shell" set:content="pub" />
      <site name="testing">
        <patch:delete />
      </site>
      <!-- OPTIONAL FOR CHANGING TO PUB DB -->
	  <site name="MySite">
		<patch:attribute name="database">pub</patch:attribute>
	  </site>
    </sites>
    <IDTable>
      <!-- OPTIONAL FOR CHANGING TO PUB DB -->
      <param connectionStringName="master" set:connectionStringName="pub" />
    </IDTable>
    <databases>
      <database id="master">
        <patch:delete />
      </database>
      <!-- OPTIONAL FOR CHANGING TO PUB DB -->
      <database id="web">
        <patch:delete />
      </database>	  
      <!-- STILL NOT 100% SURE THIS IS NEEDED, BUT IT WORKS FOR US -->
	  <database id="pub" singleInstance="true" type="Sitecore.Data.Database, Sitecore.Kernel">
		<Engines.HistoryEngine.Storage>
          <obj type="Sitecore.Data.$(database).$(database)HistoryStorage, Sitecore.Kernel">
            <param connectionStringName="$(id)" />
            <EntryLifeTime>30.00:00:00</EntryLifeTime>
          </obj>
        </Engines.HistoryEngine.Storage>
        <Engines.HistoryEngine.SaveDotNetCallStack>false</Engines.HistoryEngine.SaveDotNetCallStack>
      </database>	  
    </databases>
    <search>
      <configuration>
        <indexes>
          <index>
            <locations>
              <master>
                <patch:delete />
              </master>
            </locations>
          </index>
        </indexes>
      </configuration>
    </search>
    <scheduling>
      <agent type="Sitecore.Tasks.CleanupFDAObsoleteMediaData">
        <databases hint="raw:AddDatabase">
          <database name="master">
            <patch:delete />
          </database>
        </databases>
      </agent>
      <agent type="Sitecore.Tasks.DatabaseAgent">
         <patch:delete />
      </agent>
      <agent type="Sitecore.Tasks.DatabaseAgent">
         <patch:delete />
      </agent>
      <agent type="Sitecore.Tasks.DatabaseAgent" method="Run" interval="00:10:00">
        <param desc="database">core</param>
        <param desc="schedule root">/sitecore/system/tasks/schedules</param>
        <LogActivity>true</LogActivity>
      </agent>
    </scheduling>
    <contentSearch>
	  <indexUpdateStrategies>
                <!-- OPTIONAL FOR CHANGING TO PUB DB -->
		<onPublishEndAsync>
		  <param desc="database" patch:instead="param[desc='database']">pub</param>
		</onPublishEndAsync>
                <!-- THIS CAUSES INDEX ISSUES ON THE CONTENT DELIVERY NODES -->
		<syncMaster>
		  <patch:delete />
		</syncMaster>
	  </indexUpdateStrategies>
	  <configuration>
	     <indexes>
                    <!-- THIS SHOULDN'T REALLY BE ON CONTENT DELIVERY -->
			<index id="sitecore_master_index">
				<patch:delete/>
			</index>
                <!-- OPTIONAL FOR USING A PUB DB -->
			<index id="sitecore_web_index">
				<patch:delete/>
			</index>
		 </indexes>
	  </configuration>	  
	</contentSearch>
  </sitecore>
</configuration>

Please note, this version also changes the content delivery servers to use the ‘pub’ database which we have set up as a publishing target to allow the content editors to have the ability to view a pre-live version of the content by publishing to the web database.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s