Alfresco 5.0.d – Installing SOLR 4 from scratch

SOLR 4 artifacts can be downloaded individually from Alfresco Wiki at Community file list page:

These artifacts are enough to install SOLR in a different Tomcat from Alfresco, apart from a standard Apache Tomcat 7 distribution.

For this blog post, Java 8 and a running Alfresco 5.0.d installed in /opt/alfresco running in port 8080 is required.

Installing Tomcat 7

Create a working directory and unzip Tomcat 7 software.

$ mkdir /opt/alfresco-solr4-5
$ cd /opt
$ cp apache-tomcat-7.0.69.zip alfresco-solr4-5
$ cd alfresco-solr4-5
$ unzip apache-tomcat-7.0.69
$ mv apache-tomcat-7.0.69 tomcat

Copy SOLR 4 web application by using solr4.war name.

$ cp alfresco-solr4-5.0.d.war /opt/alfresco-solr4-5/tomcat/webapps/solr4.war

Configure Tomcat to run in port 9XXX and to use Alfresco keystore.

<?xml version='1.0' encoding='utf-8'?>
<Server port="9005" shutdown="SHUTDOWN">
  <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
  <Listener className="org.apache.catalina.core.JasperListener" />
  <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
  <GlobalNamingResources>
    <Resource name="UserDatabase" auth="Container" type="org.apache.catalina.UserDatabase" description="User database that can be updated and saved" factory="org.apache.catalina.users.MemoryUserDatabaseFactory" pathname="conf/tomcat-users.xml" />
  </GlobalNamingResources>
  <Service name="Catalina">
    <Connector port="9080" URIEncoding="UTF-8" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="9443" maxHttpHeaderSize="32768" />
    <Connector port="9009" URIEncoding="UTF-8" protocol="AJP/1.3" redirectPort="9443" />

    <Connector port="9443" URIEncoding="UTF-8" protocol="org.apache.coyote.http11.Http11Protocol" SSLEnabled="true" maxThreads="150" scheme="https" keystoreFile="/opt/alfresco/alf_data/keystore/ssl.keystore" keystorePass="kT9X6oe68t" keystoreType="JCEKS" secure="true" connectionTimeout="240000" truststoreFile="/opt/alfresco/alf_data/keystore/ssl.truststore" truststorePass="kT9X6oe68t" truststoreType="JCEKS" clientAuth="want" sslProtocol="TLS" allowUnsafeLegacyRenegotiation="true" maxHttpHeaderSize="32768" />  

    <Engine name="Catalina" defaultHost="localhost">
      <Realm className="org.apache.catalina.realm.LockOutRealm">
        <Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/>
      </Realm>

      <Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true">
        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="localhost_access_log." suffix=".txt" pattern="%h %l %u %t &quot;%r&quot; %s %b" />

      </Host>
    </Engine>
  </Service>
</Server>

 

Configuring SOLR cores

Create space to store SOLR indexes.

$ mkdir /opt/alfresco-solr4-5/alf_data/solr4

Copy SOLR cores configuration

$ unzip alfresco-solr4-5.0.d-config.zip /opt/alfresco-solr4-5/solr4

Configure each SOLR core to use that space.

$ vi /opt/alfresco-solr4-5/solr4/archive-SpacesStore/conf/solrcore.properties

data.dir.root=/opt/alfresco-solr4-5/solr4/index
alfresco.secureComms=https

$ vi /opt/alfresco-solr4-5/solr4/workspace-SpacesStore/conf/solrcore.properties

data.dir.root=/opt/alfresco-solr4-5/solr4/index
alfresco.secureComms=https

 

Configuring SOLR software

Create SOLR configuration for Tomcat web application.

$ vi /opt/alfresco-solr4-5/tomcat/conf/Catalina/localhost/solr4.xml
<?xml version="1.0" encoding="utf-8"?>
<Context debug="0" crossContext="true">
  <Environment name="solr/home" type="java.lang.String" value="/opt/alfresco-solr4-5/solr4" override="true"/>
  <Environment name="solr/model/dir" type="java.lang.String" value="/opt/alfresco-solr4-5/alf_data/solr4/model" override="true"/>
  <Environment name="solr/content/dir" type="java.lang.String" value="/opt/alfresco-solr4-5/alf_data/solr4/content" override="true"/>
</Context>

Adjusting Alfresco configuration

Alfresco properties file have to be modified in order to use that new SOLR by editing these lines in /opt/alfresco/tomcat/shared/classes/alfresco-global.properties

### Solr indexing ###
index.subsystem.name=solr4
dir.keystore=${dir.root}/keystore
solr.port.ssl=9443

Original Alfresco resources for SOLR (configuration, contents and web app) can be removed from this installation, as SOLR will run in a different app server.

$ rm -rf /opt/alfresco/solr4
$ rm -rf /opt/alfresco/alf_data/solr4
$ rm -rf /opt/alfresco/tomcat/webapps/solr4.war
$ rm -rf /opt/alfresco/tomcat/webapps/solr4

Restart Alfresco after.

$ /opt/alfresco/alfresco.sh restart

 

Testing configuration

Start Tomcat

$ /opt/alfresco-solr4-5/tomcat/bin/catalina.sh start

You will be able to index and search in your main Alfresco installation at http://localhost:8080/share and your SOLR web console will be available at https://localhost:9443/solr4.

This method can be applied with minor changes to other Alfresco CE 5.X releases.

 

Responder

Introduce tus datos o haz clic en un icono para iniciar sesión:

Logo de WordPress.com

Estás comentando usando tu cuenta de WordPress.com. Cerrar sesión / Cambiar )

Imagen de Twitter

Estás comentando usando tu cuenta de Twitter. Cerrar sesión / Cambiar )

Foto de Facebook

Estás comentando usando tu cuenta de Facebook. Cerrar sesión / Cambiar )

Google+ photo

Estás comentando usando tu cuenta de Google+. Cerrar sesión / Cambiar )

Conectando a %s