Caution: This documentation is for eZ Publish legacy, from version 3.x to 6.x.
For 5.x documentation covering Platform see eZ Documentation Center, for difference between legacy and Platform see 5.x Architecture overview.

Using multi-core features

As mentioned before, you are able to set up a single Solr instance, the backend engine of eZ Find, to serve multiple sites (it does not even matter if these are on the same box). Similar to a database, Solr is capable of having multiple search indexes from one servlet, because Solr supports the concepts of multiple "cores". This means that it can run multiple instances of itself inside a servlet container. Each core has its own set of configuration files (including the "schema") and dedicated directories.

Lets go through the steps of setting up a Solr instance which must serve two sites. To keep it simple we'll call them ezlabs .no and ez.no.

  1. The easiest way is to first prepare a central location for the Solr Index. This can for example be:

    /srv/solr
    
  2.  Next you should create two additional directories inside it, as follows:
    /srv/solr/java
    /srv/solr/cores
    
  3.  Inside /srv/solr/java you should store a copy of the contents of the java directory of your eZ Find installation, or if you don't have one yet, download it from http://ez.no/ezfind.
  4.  Next create a symlink for the solr/lib plugin directory inside /srv/solr/cores like this:
    ln -s /srv/solr/java/solr/lib /srv/solr/cores
    
  5.  Create additional directories for each of your sites, called ezlabs and ez  in your /srv/solr/cores. Both of them must contain a data and a conf sub-directory.
     Your file structure should look something like this:
    /srv/solr/cores
           ezlabsno/data
           ezlabsno/conf
     
           ezno/data
           ezno/conf
    
  6.  In both conf directories you must then copy the contents of the folder extension/ezfind/java/solr/conf/* and adapt the Solr dataDir.
  7.  Next create a solr.xml file inside /srv/solr/cores/solr.xml with the following content:
    <?xml version="1.0" encoding="UTF-8" ?>
    <!-- snip the comments from Apache wiki -->
    <solr persistent="true" sharedLib="lib">
        <cores adminPath="/admin/cores">
             <core name="ezlabsno" instanceDir="ezlabsno" />
             <core name="ezno" instanceDir="ezno" />
        </cores>
    </solr>
    
  8.  If you already have indexed data for one or both of your sites, you may stop Solr from indexing them again. You should then copy the index and spellchecker directories to your data directories (in /srv/solr/cores/ezlabsno/data and /srv/solr/cores/ezno/data).
  9.  Now you should restart Solr with the following parameters:
    cd /srv/solr/java; java -Dsolr.solr.home=/srv/solr/cores -jar start.jar
    
  10.  It's important to keep an eye on the output, in case of potential errors (for example things that are permission related).
  11.  And finally you can configure the individual eZ Publish and eZ Find instances with the dedicated  URLs as base URLs in solr.ini:
http://localhost:8983/solr/ezlabsno
 
http://localhost:8983/solr/ezno

Geir Arne Waaler (05/10/2011 2:13 pm)

Geir Arne Waaler (07/10/2011 11:14 am)


Comments

  • something missing?

    I guess something is missing after "Now you should restart Solr with the following parameters as follows:"
    isn't it?
  • yes... not working

    The above advices are not complete, as I said before.
    (I've spent 3hr already on this.... geee!)

    there is sure another mistake

     instanceDir="siteoneno "
    


    should be

     instanceDir="siteoneno"
    


    without the blank space at the end, isn't it?

    (see http://wiki.apache.org/solr/CoreAdmin )
  • still not working

    Thank you for the updates.
    It still does not work for us (while it works with single solr).

    We get this error (with our server is Debian lenny)

    28-nov-2009 19.39.38 org.apache.solr.request.XSLTResponseWriter init
    INFO: xsltCacheLifetimeSeconds=5
    28-nov-2009 19.39.38 org.apache.solr.core.RequestHandlers initHandlersFromConfig
    INFO: created standard: solr.SearchHandler
    28-nov-2009 19.39.38 org.apache.solr.core.RequestHandlers initHandlersFromConfig
    INFO: created dismax: solr.SearchHandler
    28-nov-2009 19.39.38 org.apache.solr.core.RequestHandlers initHandlersFromConfig
    INFO: created partitioned: solr.SearchHandler
    28-nov-2009 19.39.38 org.apache.solr.core.RequestHandlers initHandlersFromConfig
    INFO: created ezpublish: solr.DisMaxRequestHandler
    28-nov-2009 19.39.38 org.apache.solr.common.SolrException log
    GRAVE: org.apache.solr.common.SolrException: Error loading class 'org.ezsystems.solr.handler.ezfind.eZFindRequestHandler'
    	at org.apache.solr.core.SolrResourceLoader.findClass(SolrResourceLoader.java:310)
    	at org.apache.solr.core.SolrCore.createInstance(SolrCore.java:411)
    	at org.apache.solr.core.SolrCore.createRequestHandler(SolrCore.java:436)
    	at org.apache.solr.core.RequestHandlers.initHandlersFromConfig(RequestHandlers.java:150)
    	at org.apache.solr.core.SolrCore.<init>(SolrCore.java:541)
    	at org.apache.solr.core.CoreContainer.create(CoreContainer.java:425)
    	at org.apache.solr.core.CoreContainer.load(CoreContainer.java:278)
    	at org.apache.solr.core.CoreContainer$Initializer.initialize(CoreContainer.java:117)
    	at org.apache.solr.servlet.SolrDispatchFilter.init(SolrDispatchFilter.java:83)
    	at org.mortbay.jetty.servlet.FilterHolder.doStart(FilterHolder.java:99)
    	at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)
    	at org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:594)
    	at org.mortbay.jetty.servlet.Context.startContext(Context.java:139)
    	at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1218)
    	at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:500)
    	at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:448)
    	at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)
    	at org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:147)
    	at org.mortbay.jetty.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:161)
    	at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)
    	at org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:147)
    	at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)
    	at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:117)
    	at org.mortbay.jetty.Server.doStart(Server.java:210)
    	at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)
    	at org.mortbay.xml.XmlConfiguration.main(XmlConfiguration.java:929)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    	at java.lang.reflect.Method.invoke(Unknown Source)
    	at org.mortbay.start.Main.invokeMain(Main.java:183)
    	at org.mortbay.start.Main.start(Main.java:497)
    	at org.mortbay.start.Main.main(Main.java:115)
    Caused by: java.lang.ClassNotFoundException: org.ezsystems.solr.handler.ezfind.eZFindRequestHandler
    	at java.net.URLClassLoader$1.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at java.net.URLClassLoader.findClass(Unknown Source)
    	at java.lang.ClassLoader.loadClass(Unknown Source)
    	at java.lang.ClassLoader.loadClass(Unknown Source)
    	at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:375)
    	at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:337)
    	at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    	at java.lang.Class.forName0(Native Method)
    	at java.lang.Class.forName(Unknown Source)
    	at org.apache.solr.core.SolrResourceLoader.findClass(SolrResourceLoader.java:294)
    	... 32 more
     
    


    while trying to surf in http://localhost... we get "severe SOLR configuration error"

    :(

    We do really need to have solr working for several ez websites

    Thank you for your help,
    Fra
    • Re: still not working

      I can't say if this is the same problem but I just got the same error (GRAVE: org.apache.solr.common.SolrException: Error loading class 'org.ezsystems.solr.handler.ezfind.eZFindRequestHandler).

      The directory extension/ezfind/java/solr/lib/ was missing and, with it, the file ezsystems-ezfind-solr-extension-2.1.jar.
      I kinda messed up using SVN to transfer eZFind from one box to another.

      mes deux centimes de franc ...
  • Typo in solr.xml

    It seems that the line which says:

    <solr persistent="true" shareLib="lib">

    has a typo. I've had much more success using

    <solr persistent="true" sharedLib="lib">

    (shared, not share)
  • My Multi-Core Woes [RESOLVED]

    I was able to get mult-core installed with the instructions above. But the search did not work for my sites. My check list looked like this.

    Solr running: OK,
    Solr Administration Pages working: OK,
    Index with updatesearchindexsolr.php: OK,?
    Synchronize from site_admin: FAILED,
    Search results from site: FAILED,

    [SOLUTION]

    Make a change to each sites extension/ezfind/settings/solr.ini . add /<corename> to the end of each SearchServerURI like below:

    [SolrBase]
    # Base URI of the Solr server
    SearchServerURI=http://localhost:8983/solr/site1

    You must then re-index each site with php extension/ezfind/bin/php/updatesearchindexsolr.php -s site_admin