Configure Solr Replication

This guide explains how to configure Solr replication between a master Solr in an authoring server, and several slave Solrs in delivery servers. It’s assumed you already have installed Studio in the authoring server (Install Studio) and Engine in the delivery servers (Install Engine).

Authoring Configuration

  1. In your Studio INSTALL_DIR, go to apache-tomcat/webapps, duplicate the solr.war and rename the new file to as solr-crafter-live.war.

  2. In the same folder, duplicate the crafter-search.war and rename the file to crafter-search-live.war.

  3. Go to INSTALL_DIR/apache-tomcat/conf/Catalina/localhost and create the solr-crafter-live.xml file with the following content:

    <?xml version="1.0" encoding="utf-8"?>
    <Context docBase="./apache-tomcat/webapps/solr-crafter-live.war" debug="0" crossContext="true">
        <Environment name="solr/home" type="java.lang.String" value="./apache-tomcat/solr-crafter-live" override="true"/>
        <Loader className="org.apache.catalina.loader.VirtualWebappLoader" virtualClasspath="./apache-tomcat/solr-crafter-live/lib/ext/*.jar;./apache-tomcat/solr-crafter-live/lib/ext/;./apache-tomcat/solr-crafter-live/lib/extraction/*.jar"/>
  4. Under the same directory, create a crafter-search-live.xml file with the following content:

    <?xml version="1.0" encoding="utf-8"?>
    <Context docBase="./apache-tomcat/webapps/crafter-search-live.war" debug="0" crossContext="true">
        <Environment name="" type="java.lang.String" value="classpath*:crafter/search-live/extension" override="false"/>
  5. Under INSTALL_DIR/apache-tomcat, duplicate the solr-crafter directory and rename it as solr-crafter-live. Delete the data directory under it.

  6. Under the new solr-crafter-live directory:

    1. Duplicate the solrconfig.xml and rename it as solrconfig_slave.xml. This solrconfig_slave.xml is the Solr configuration that will be propagated to all the slaves.

    2. Open solrconfig.xml and look for the line that has <requestHandler name="/replication" class="solr.ReplicationHandler">. Replace the entire <requestHandler> tag for the following:

      <requestHandler name="/replication" class="solr.ReplicationHandler" >
          <lst name="master">
              <str name="replicateAfter">commit</str>
              <str name="replicateAfter">startup</str>
              <str name="confFiles">solrconfig_slave.xml:solrconfig.xml,schema.xml,stopwords.txt</str>
    3. Change also the <dataDir> value in solrconfig.xml to a more appropriate path, like how it was done in Install Studio. An example would be <dataDir>/opt/crafter/data/live-indexes</dataDir>

    4. Open the solrconfig_slave.xml file and replace the same <requestHandler> tag for the following (please change the {STUDIO_SERVER_HOST} and {STUDIO_SERVER_PORT}):

      <requestHandler name="/replication" class="solr.ReplicationHandler" >
          <lst name="slave">
              <str name="masterUrl">http://{STUDIO_SERVER_HOST}:{STUDIO_SERVER_PORT}/solr-crafter-live</str>
              <!--The following values are used when the slave connects to the master to
              download the index files.
              Default values implicitly set as 5000ms and 10000ms respectively. The user DOES
              NOT need to specify
              these unless the bandwidth is extremely low or if there is an extremely high
              <str name="httpConnTimeout">5000</str>
              <str name="httpReadTimeout">10000</str>
    5. Still in the same file, change the <dataDir> to match the path in the delivery servers.

  7. Go to /opt/crafter/authoring/apache-tomcat/shared/classes/crafter, and create the folder structure search-live/extension. Under search-live/extension, create a file called and add the following text:

Delivery Configuration

So that the Solr config can be correctly replicated between the master and slaves, the solrconfig_slave.xml must be initially copied manually. Copy it from the authoring server to each of the delivery servers, to the INSTALL_DIR/apache-tomcat/solr-crafter/conf folder, and rename it to solrconfig.xml (delete the previous solrconfig.xml).