Tuesday, December 4, 2012

How to disable SOLR and enable Lucene on Alfresco


In Association with Amazon.in



Following are the steps to turn off SOLR and use Lucene on the fresh Alfresco install:


     1) Stop Alfresco.

     2) Comment all SOLR related properties and Uncomment all LUCENE related properties in /tomcat/shared/classes/alfresco-global.properties file.
 
      Following are properties for SOLR.
### Solr indexing ###

# The subsystem type value. Value is either solr or lucene.
index.subsystem.name=solr

# Absolute Path to your keystore directory for configuring Alfresco to talk to SOLR
dir.keystore=/alfresco/alf_data/keystore
# Solr hostname
solr.host=localhost

# Http port
solr.port=8080

# Https port
solr.port.ssl=8443

# Value can be https, or none
solr.secureComms=https

### Solr indexing ###

Following are properties for LUCENE.
### Lucene indexing ###

# The subsystem type value. Value is either solr or lucene.
index.subsystem.name=lucene

# The location for lucene index files
dir.indexes=/alfresco/alf_indexes/lucene-indexes

# The location for index backups
dir.indexes.backup=/alfresco/alf_indexes/backup-lucene-indexes

# Index recovery types; value can be NONE, VALIDATE, AUTO, FULL.
index.recovery.mode=FULL

### Lucene indexing ### 

3) Now, delete a) /alfresco/alf_data/solr folder,  
     b) tomcat/conf/Catalina/localhost/solr.xml file, &
                             c)  tomcat/webapps/solr folder.

4) Start Alfresco.

5) Now, Stop Alfresco after Full Indexing gets over and tomcat successfully starts up.

6) Edit following property in /tomcat/shared/classes/alfresco-global.properties file.

# Index recovery types; value can be NONE, VALIDATE, AUTO, FULL.
index.recovery.mode=AUTO

7) Start Alfresco.

NOTE: If you miss (Step 3) then, you may get following exceptions:

Exception #1:
SEVERE: Job (Solr.CoreTracker-alfresco threw an exception.
org.quartz.SchedulerException: Job threw an unhandled exception. [See nested exception: org.alfresco.error.AlfrescoRuntimeException: 11040159 GetModelsDiff return status is 404]

        at org.quartz.core.JobRunShell.run(JobRunShell.java:227)
        at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:563)
Caused by: org.alfresco.error.AlfrescoRuntimeException: 11040159 GetModelsDiff return status is 404
        at org.alfresco.solr.client.SOLRAPIClient.getModelsDiff(SOLRAPIClient.java:1036)
        at org.alfresco.solr.tracker.CoreTracker.trackModels(CoreTracker.java:1863)
        at org.alfresco.solr.tracker.CoreTracker.trackRepository(CoreTracker.java:1202)
        at org.alfresco.solr.tracker.CoreTracker.updateIndex(CoreTracker.java:548)
        at org.alfresco.solr.tracker.CoreTrackerJob.execute(CoreTrackerJob.java:45)
        at org.quartz.core.JobRunShell.run(JobRunShell.java:216)
        ... 1 more

Cause: The above exception comes when you forgot to delete tomcat/conf/Catalina/localhost/solr.xml file.

Exception #2: 
SEVERE: Could not start SOLR. Check solr/home property
java.lang.RuntimeException: Can't find resource 'solrconfig.xml' in classpath or 'solr/conf/', cwd=/var/lib/tomcat6
      at org.apache.solr.core.SolrResourceLoader.openResource(SolrResourceLoader.java:262)
      at org.apache.solr.core.SolrResourceLoader.openConfig(SolrResourceLoader.java:230)
      at org.apache.solr.core.Config.(Config.java:101)
      at org.apache.solr.core.SolrConfig.(SolrConfig.java:130)
      at org.apache.solr.core.CoreContainer$Initializer.initialize(CoreContainer.java:134)
      at org.apache.solr.servlet.SolrDispatchFilter.init(SolrDispatchFilter.java:83)
      at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:295)
      at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:422)
      at org.apache.catalina.core.ApplicationFilterConfig.(ApplicationFilterConfig.java:115)
      at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4072)
      at org.apache.catalina.core.StandardContext.start(StandardContext.java:4726)
      at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)
      at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)
      at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601)
      at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:943)
      at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:778)
      at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:504)
      at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1317)
      at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:324)
      at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
      at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1065)
      at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
      at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
      at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
      at org.apache.catalina.core.StandardService.start(StandardService.java:525)
      at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
      at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:616)
      at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
      at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)

Cause: The above exception comes when you forgot to delete tomcat/webapps/solr folder.

In Association with Amazon.in

4 comments:

  1. Thanks Deepak. This is very helpful. Just curious why switch from solr to lucene?

    ReplyDelete
  2. Thanks very much.. :)

    Its depends on the biz requirements. The following link provides the details, when you need to use Lucene instead of SOLR.
    http://docs.alfresco.com/4.2/topic/com.alfresco.enterprise.doc/concepts/solr-choosing.html

    And this link provides advantages of SOLR over Lucene:
    http://docs.alfresco.com/4.2/topic/com.alfresco.enterprise.doc/concepts/solr-benefits.html

    ReplyDelete
  3. Thanks for the post. For me Lucene is easier than Solr after tried rebuild indexing all day long.

    ReplyDelete
  4. Thank you so much Su Diro for following my post. :)

    ReplyDelete