• Home
  • Docker
  • Kubernetes
  • Java
  • Ubuntu
  • Maven
  • Big Data
  • CI
  • Install
  • Samples
  • Archived
Apache Solr | Install and configure a Solr Cloud (Cluster)
  1. Prerequisites: ZooKeeper Server and ZooKeeper "chroot"
  2. Install and configure a Solr Cluster on 2 different hosts
    1. Download and Install Apache Solr
    2. Configuration files and environment variables
    3. Start Solr
    4. Stop Solr
  3. Install and configure a Solr Cluster on the same host
  4. Install and configure a Solr Cluster on the same host, using the same Solr binary distribution

  1. Prerequisites: ZooKeeper Server and ZooKeeper "chroot"
    To form a Solr Cluster you will need to install and configure ZooKeeper: see Install and configure a ZooKeeper

    By default, Solr configuration will be pushed to ZooKeeper and will be created under the ZooKeeper root znode "/".
    To be able to create the Solr configuration under a custom location (ie: "/solr"), you need to use ZooKeeper "chroot".
    The usage of ZooKeeper "chroot" is not mandatory but it's considered as a best practice.

    If you choose to have Solr configuration created under a custom location, then you have to create manually the "chroot" znode in ZooKeeper.
    You can use ZooKeeper Command Line Utilities file "zkCli.sh" to create your "chroot" znode (ie: "/solr"):

  2. Install and configure a Solr Cluster on 2 different host
    We will install Solr on 2 different hosts: "solrhost1", and "solrhost2"

    Assuming we have already installed and configured ZooKeeper. One ZooKeeper instance should be sufficient but we will assume that we have a ZooKeeper Cluster formed of 3 nodes installed on 3 different hosts: "zkhost1", "zkhost2", and "zkhost3"

    On each Solr host, do the following:

    1. Download and Install Apache Solr
      • Download Apache Solr http://lucene.apache.org/solr/

      • Extract the file "solr-9.8.1.zip" in the folder you want to install Solr: /opt/solr-9.8.1

      • Create a symbolic link of the Solr installation folder:

      • Change the folders permissions (if needed):
    2. Configuration files and environment variables
      ${SOLR_HOME} (or solr.solr.home) represents the path of the Solr home directory: /opt/solr/server/solr

      ${SOLR_ROOT} represents the path of the Solr installation folder: /opt/solr/

      Configuration files:
      ► "${SOLR_HOME}/solr.xml"

      Solr home directory ${SOLR_HOME} must contain a solr.xml file, otherwise Solr will fail to start.
    3. Start Solr
      Start Solr on each Solr host ("solrhost1", "solrhost2")

      You can omit -z "zkhost1:2181,zkhost2:2181,zkhost3:2181/solr" from the above command if you have defined "ZK_HOST" in "solr.in.sh".

      Typically, you can use one of the following options to start Solr:

      • Specifying a ZooKeeper instance (not recommended to not setting a ZooKeeper chroot ):

      • Specifying a ZooKeeper instance + setting ZooKeeper chroot to "/solr" (the znode "/solr" has to be created first in ZooKeeper):

      • Specifying multiple ZooKeeper instances:

      • Adding additional JVM parameters (start Solr running in SolrCloud mode with 1g max heap size and remote Java debug options enabled):

      Access the Solr Admin UI: http://solrhost1:8983/solr

      Apache Solr/SolrCloud

      Notes:

      • If you are using ZooKeeper "chroot", make sure that the Solr znode is created first in ZooKeeper ("/solr").

        Otherwise you will get this error at startup:

      • At startup, Solr will try to upload the "_default" configuration to ZooKeeper ("${SOLR_HOME}/configsets/_default").

      • Verify that the ZooKeeper instances are up and running, otherwise Solr won't start correctly.

      • If all ZooKeeper instances, specified in the "-z" parameter, go down, Solr will lose connection with ZooKeeper even if the ZooKeeper ensemble contains other instances that are up and running.

      • You can specify memory options: -m 512m (default)

      • On windows, you need to put the ZooKeeper hosts between double quotes: -z "zkhost1:2181,zkhost2:2181,zkhost3:2181/solr"

    4. Stop Solr
      To stop Solr, you need to run the following command on each Solr host ("solrhost1", "solrhost2")

      You can also stop Solr server for which the HTTP listener is bound to the specified port:
  3. Install and configure a Solr Cluster on the same host
    To form a Solr Cluster you will need to install and configure ZooKeeper: see Install and configure a ZooKeeper Cluster on the same host
    We will assume that we have a ZooKeeper Cluster formed of 3 nodes installed on the same host where Solr will be installed.

    You have to create manually the znode "/solr" in ZooKeeper.

    Extract the content of "solr-9.8.1.zip" file to 2 locations of your choice:
    ► /opt/solr-i1
    ► /opt/solr-i2

    Running the first Solr instance (port: 8983)

    Running the second Solr instance (port: 8984)

    Access the Solr Admin UI: http://localhost:8983/solr

    Apache Solr/solrcloud: 2 instances on same host

    To stop Solr:

  4. Install and configure a Solr Cluster on the same host, using the same Solr binary distribution
    To form a Solr Cluster you will need to install and configure ZooKeeper: see Install and configure a ZooKeeper Cluster on the same host
    We will assume that we have a ZooKeeper Cluster formed of 3 nodes installed on the same host where Solr will be installed.

    You have to create manually the znode "/solr" in ZooKeeper.

    Extract the content of "solr-9.8.1.zip" file to a location of your choice:
    ► /opt/solr

    Here are the steps to follow:
    • You need to create a folder that will hold the configuration for each Solr instance (you can choose any path you want): solr1, solr2, ...

    • On each Solr instance home folder (solr1, solr2, ...), you need to copy the "solr.xml" file from "/opt/solr/server/solr".

    • On each Solr instance home folder (solr1, solr2, ...), you need to create a "logs" directory.

    • (Linux) Modify the file /opt/solr/bin/solr:

    • (Windows) Modify the file solr.cmd:
    Running the first Solr instance (port: 8983)

    Running the second Solr instance (port: 8984)

    To stop Solr:


    You can also try this command to stop all running Solr servers on a host:
© 2025  mtitek