Let's talk Contact us. No cost. No obligation.

Fill out this form and we will contact you with in 24 hrs.

captcha

8+3=? 

 

Knowledge Base

Solr Multicore Setup

April 18, 2014

Multi-core in the context of Solr simply means running multiple instances of Solr using the same servlet container allowing for separate configurations and indexes per core while still allowing administration through one interface.

The Solr wiki describes this feature as:

Multiple cores let you have a single Solr instance with separate configurations and indexes, with their own config and schema for very different applications, but still have the convenience of unified administration. Individual indexes are still fairly isolated, but you can manage them as a single application, create new indexes on the fly by spinning up new SolrCores, and even make one SolrCore replace another SolrCore without ever restarting your Servlet Container .

Change Port Number:

Multicore Setup Steps:

1) In order to make Solr use the multicore setup we provide solr with the dir it should use when starting solr itself. For this a shell script was created with the contents given below The file is located here: /opt/solr/apache-solr-4.2.1/example/startsolr.multicore.sh ->

WORK_DIR=/opt/solr/apache-solr-4.2.1/example/work
JETTY_HOME=/opt/solr/apache-solr-4.2.1/example

HOST_NAME=`hostname`
export JAVA_HOME=$JETTY_HOME/java-1.6.0-openjdk

#Start multicore
sudo java -server -Dsolr.solr.home=/opt/solr/apache-solr-4.2.1/example/multicore -Djava.io.tmpdir=$JETTY_HOME/tmp -Djetty.home=/opt/solr/apache-solr-4.2.1/example -Djetty.host=$HOST_NAME -DSTOP.PORT=8090 -DSTOP.KEY=stopsolr -Xmx10240M -javaagent:/home/ubuntu/newrelic/newrelic.jar -jar /opt/solr/apache-solr-4.2.1/example/start.jar >> $JETTY_HOME/startsolr.log 2>> $JETTY_HOME/startsolr.multicore.log&

In the above sh code :

a) The solr.solr.home set to the multicore directory.

b) Other parameters include the tmp dir, stopport.

c) The -Xmx10240M is to make the memory used to 10GB.

Logging each requests to Solr:
d) The above also adds the last part for logging all requests to Solr into this file startsolr.multicore.log

2) Edit the file ‘/opt/solr/apache-solr-4.2.1/example/multicore/solr.xml’ and add the following code

About Amit Kumar Singh

Amit is leading JAVA team with his 6+ years of experience in Java Technology including J2SE, J2EE including Servlet, JSP, Struts, Spring,Hibernate, PhoneGap, Postgres. The Project which is successfully implemented and running based on the OfBiz and Adempier backed by robust Framework.