A D Vishnu Prasad

Director of Cloud Engineering @ Team8Solutions, Freelancer

Multiple Solr Servers in Single Machine

Step 1:

Go to your solr directory.

1
2
3
4
cd /opt/solr141/
sudo mkdir home1
copy contents into home1 directory from other home directory.
sudo cp -a /opt/solr141/home/. /opt/solr141/home1

Step 2:

create solr1.xml under tomcat6/conf/catalina/localhost. Copy from solr.xml and just change value to point to new home dir in environment tag

1
2
3
4
<!--?xml version="1.0" encoding="utf-8" ?-->
<Context docBase="/opt/solr/solr141/dist/apache-solr-1.4.1.war" debug="0" crossContext="true" >
<Environment name="solr/home" type="java.lang.String" value="/opt/solr/solr141/home1" override="true" />
</Context>

Step 3:

/opt/solr/solr141/home1/conf/Solr-config.xml
1
2
3
<dataDir>${solr.data.dir:/opt/solr/solr141/home1/data}</dataDir>
<locktype>simple</locktype>
<unlockonstartup>true</unlockonstartup>

Step 4:

Restart tomcat

1
sudo service tomcat6 restart

Step 5:

Since we copied from other home folder, we need to clean up the index

1
curl localhost:7585/solr1/update --data '*:*' -H 'Content-type:text/xml; charset=utf-8'

There you go.

localhost:8080/solr1 should be up and running

Comments