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.
The easiest way is to first prepare a central location for the Solr Index. This can for example be:
/srv/solr
- Next you should create two additional directories inside it, as follows:
/srv/solr/java /srv/solr/cores
- 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.
- 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
- 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 subdirectory.
Your file structure should look something like this:
/srv/solr/cores ezlabsno/data ezlabsno/conf ezno/data ezno/conf
- In both conf directories you must then copy the contents of the folder extension/ezfind/java/solr/conf/* and adapt the Solr dataDir.
- 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>
- 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).
- Now you should restart Solr with the following parameters:
cd /srv/solr/java; java -Dsolr.solr.home=/srv/solr/cores -jar start.jar
- It's important to keep an eye on the output, in case of potential errors (for example things that are permission related).
- 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
Ester Heylen (01/04/2010 3:21 pm)
Ester Heylen (01/04/2010 3:21 pm)
Comments