Tuesday, December 24, 2013

Configuring Solr and Alfresco on different tomcat

Alfresco supports Solr Enterprise search platform which is open source enterprise search platform.

In new alfresco version, Solr is default search engine and If you have installed alfresco using setup wizard then it comes with alfresco bundle. In newer version Solr is not deployed under tomcat/webapps due to different behavior of tomcat 7.

In your production environment, You might need solr to run on different application server than alfresco. So Here I would describe detail steps to configure solr on different standalone application server.

Assuming you have standalone tomcat running in your env on port 8080 and SSL port 8443 and have existing alfresco installed on another tomcat on port 9090 and SSL port 8444

We will refer 
TOMCAT_HOME_ALFRESCO  - where Alfresco is installed
TOMCAT_HOME_SOLR - where Solr is installed
SOLR_HOME - where we will extract all solr related file

Step 1: Get  alfresco-enterprise-solr-4.2.0.zip and extract it to SOLR_HOME

Step 2: Create solr.xml file under TOMCAT_HOME_SOLR\conf\Catalina\localhost and copy context.xml file to this solr.xml. [You can get context.xml file under SOLR_HOME]

Step 3: Modify solr.xml and edit docBase and solr/home
docBase should point to - SOLR_HOME/apache-solr-1.4.1.war
solr/home should point to - SOLR_HOME

For example: Step 4: Edit solrcore.properties to set data.dir.root where your Solr index will be stored. Modify it for both core - workspace and archive

File location:
SOLR_HOME\solr\workspace-SpacesStore\conf
SOLR_HOME\solr\archive-SpacesStore\conf

For example:
data.dir.root=D:/Alfresco_SOLR/solr/solr-index

You can define same value for both cores. It will create sub-directory for each core.

Step 5: Edit solrcore.properties. Set your alfresco server detail for both core.

alfresco.host=localhost
alfresco.port=9090
alfresco.port.ssl=8444

Before we go ahead lets generate Secure keys for communication between Alfresco and Solr

Step 6: Edit generate_keystores.bat (Windows) and generate_keystores.sh(Linux) located at SOLR_HOME\solr\alf_data\keystore and set below environment variable.

ALFRESCO_HOME
ALFRESCO_KEYSTORE_HOME
SOLR_HOME

For example:
ALFRESCO_HOME = D:\MyAlfresco
ALFRESCO_KEYSTORE_HOME=D:\Alfresco_SOLR\solr\alf_data\keystore
SOLR_HOME=D:/Alfresco_SOLR/solr

Also make sure you have proper value set for JAVA_HOME, REPO_CERT_DNAME and SOLR_CLIENT_CERT_DNAME .

Step 7: Run this script. And set dir.keystore value in your alfresco-global.properties file.

For example:
dir.keystore=D:/Alfresco_SOLR/solr/alf_data/keystore

Step 8: Edit server.xml file for both Solr and Alfresco's tomcat to use the keystore and truststore for https requests

This SSL connector settings are changed from 4.1 so make sure you configure it as below.
Removed configurations: maxSavePostSize
Added/changed configurations: clientAuth="want" maxHttpHeaderSize="32768"

Configure server.xml file location located at <TOMCAT_HOME_ALFRESCO>/conf/server.xml on connector port 8444
Configure server.xml file location located at <TOMCAT_HOME_SOLR>/conf/server.xml on connector port 8443

Step 9: Edit your alfresco-global.properties file.
Set search subsytem, dir.keystore which we already set in above step and solr server detail.

index.subsystem.name=solr
dir.keystore=D:/Alfresco_SOLR/solr/alf_data/keystore
solr.port.ssl=8443
solr.host=localhost
solr.port=8080
solr.secureComms=https

Step 10: Edit tomcat-users.xml located at TOMCAT_HOME_SOLR/conf to configure an identity for the Alfresco server.

Step 11: Edit tomcat-users.xml located at TOMCAT_HOME_ALFRESCO/conf to configure an identity for the Alfresco server.

Now, we are done with required configurations start your alfresco and Solr tomcat server and verify Solr indexes and search.
While searching on alfresco You might get below error

org.apache.tomcat.util.net.jsse.JSSESupport handShake WARNING: SSL server initiated renegotiation is disabled, closing connection

OR in solr tomcat logs you get below timeout error

WARN  [org.alfresco.solr.tracker.CoreTracker] Tracking communication timed out.

These error shows issue in communication between alfresco and solr over SSL connection.
Please check it for troubleshooting your issue - http://docs.alfresco.com/4.0/topic/com.alfresco.enterprise.doc/concepts/solr-troubleshooting.html

Alfresco version: 4.2EE


1 comment:

  1. Hi Niketa,

    I am new to Alfresco.
    Can you help in installing solr in seperate server?

    Regards,
    Arul

    ReplyDelete