Wednesday, 30 July 2014

Configuration steps for multi-core SOLR in Tomcat

This short tutorial will show you how to configure SOLR to have multiple cores. Technologies I am using:
The steps to do this are as follows:
  1. Edit Tomcat's conf/server.xml file and put URIEncoding="UTF-8" this attribute to the main Connector element.
  2. Create directory where you will keep your Solr cores configurations. For e.g. D:\Solr
  3. Create directories which will be your Solr cores inside the directory you've just created in step nr. 2. For e.g. I'll have two cores: D:\Solr\solr-core-1D:\Solr\solr-core-2
  4. Copy the file solr.xml from the directory example\multicore of downloaed and unzipped Solr archive and paste it to your Solr root directory. For e.g. : D:\Solr
  5. Edit solr.xml file depending on your core names. For e.g. in my case: <core name="solr-core-1" instanceDir="solr-core-1" />, <core name="solr-core-2" instanceDir="solr-core-2" />.
  6. Copy solr.x.x.x.war from the dist directory of the unzipped Solr archive to the Tomcat's webapps folder and rename it to solr.war.
  7. Create file called: setenv.bat in the Tomcat's bin folder. Open that file and paste this line into it: set JAVA_OPTS="-Dsolr.solr.home=D:\Solr"
  8. Open conf\solrconfig.xml files in each of the cores you have created and change the dataDir element to point to your cores' data directories. For e.g.: data directory for solr-core-1: <dataDir>D:\\Solr\\solr-core-1\\data</dataDir>
  9. Copy all the jar files from the unzipped Solr archive's directory example\lib\ext to the Tomcat's lib directory.
  10. Copy the file: example\resources\ from Solr unzipped archive into the same Tomcat's lib directory. Just make sure you change these properties according to your needs.
  11. Start the Tomcat and your Solr cores will be listed if you access this URL: http://localhost:8080/solr/#/~cores

No comments:

Post a Comment

Note: only a member of this blog may post a comment.