Solr Tomcat

Posted : admin On 1/25/2022
Skip to end of metadataGo to start of metadata

Apache Solr Reference Guide The Apache Solr Reference Guide is the official Solr documentation. As of Solr 8.2, it is published only. This post is a guide for installing Solr under Tomcat server. The steps illustrated here are tested on Mac OS, but it should also work on linux and unix systems.

Example setup for 3 node solr cloud cluster with 3 node Zookeeper ensemble

Solr Cloud machines :,,

Zookeeper machines:,,


The default directory for all the setup /home/myuser/

First bring up zookeeper ensemble

Do following steps for,, to setup zookeeper

1) Download a ZooKeeper from

2) Untar the zookeeper inside zookeeper directory. tar -xf -C /home/myuser/zookeeper/

Solr Tomcat

3) Edit zookeeper config file

vi /home/myuser/zookeeper/conf/zoo.cfg and put something similar to

# The number of milliseconds of each tick tickTime=2000

# The number of ticks that the initial synchronization phase can take initLimit=10

# The number of ticks that can pass between
# sending a request and getting an acknowledgement syncLimit=5

# the directory where the snapshot is stored.
# Choose appropriately for your environment dataDir=/home/myuser/zookeeper/data/

# the port at which the clients will connect clientPort=2181

Solr Tomcat

# the directory where transaction log is stored.
# this parameter provides dedicated log device for ZooKeeper dataLogDir=/home/myuser/zookeeper/log/

# ZooKeeper server and its port no.
# ZooKeeper ensemble should know about every other machine in the ensemble
# specify server id by creating 'myid' file in the dataDir
# use hostname instead of IP address for convenient maintenance

4) For each server create an id file in data directory and put appropriate id in the file. For example

vi /home/myuser/zookeeper/data/myid and write just 1 for in the file. For server write 2 in its myid and 3 in myid file. myid file is used to identify the zookeeper server.

4)Now start zookeeper for each server.
# cd /home/myuser/zookeeper/bin/
# ./ start

Setup tomcat

Now once zookeeper cluster is ready lets setup Solr Cloud machines :,,

Lets assume all the 3 solr machines have tomcat installed in /home/myuser/tomcat/

First lets load solr config from one of the solr machine

1) Get solr.war to machine

2) Now lets copy solr.war i to solr-war folder – cp solr.war /home/myuser/solr-war/

3) cd /home/myuser/solr-war/


4) jar xvf solr.war

5) cp WEB-INF/lib/* /home/myuser//solr-war-lib/

Solr Tomcat For Sale

6) get all the solrconfig files like solrconfig.xml, schema.xml etc in /home/myuser/solr-config/

7) Upload config to zookeeper using solr zookeeper cli

java -classpath .:/home/myuser/solr-war-lib/* -cmd upconfig -zkhost,, -confdir /home/myuser/solr-config -confname myconf

8) Link uploaded config with target collection ( assume new collection name will be mycollection)

java -classpath .:/home/myuser/solr-war-lib/* -cmd linkconfig -collection mycollection -confname myconf -zkhost,,

Now in all the solr machines do following

9) create /home/myuser/solr-cores/ for storing the solr index

10) create solr.xml in solr-cores

<?xml version='1.0' encoding='UTF-8' ?>
<solr persistent='true' sharedLib='lib'>
<cores adminPath='/admin/cores' zkClientTimeout='20000' hostPort='8080' hostContext='solr'>

11) Start the tomcat with following jvm options

Solr Tomcat 8,,

12) Put solr.war in /home/myuser/tomcat/webapps/ and restart tomcat

13 ) edit /home/myuser/tomcat/webapps/solr/META-INF/context.xml and restart tomcat

<?xml version='1.0' encoding='utf-8'?>
<Context docBase='solr.war' debug='0' crossContext='false'>
<Environment name='solr/home' type='java.lang.String' value='/home/myuser/solr-cores' override='true'/>

Solr Tomcat Vs Jetty

14) curl ''