Administer > Administration > UCMDB Server Administration > How to deploy Solr HA cluster based on Zookeeper

How to deploy Solr HA cluster based on Zookeeper

To deploy Solr HA cluster based on Zookeeper, follow these steps:

  1. Install the Apache Zookeeper. To do this follow these steps:

    1. Download Apache zookeeper 3.4.6 (https://archive.apache.org/dist/zookeeper/zookeeper-3.4.6/).

    2. Unzip the downloaded package.

      The path where you unzip the package will be later referred as <zookeeper_install_dir>.

    3. Go to the <zookeeper_install_dir>\conf folder and rename the zoo_sample.cfg file to zoo.cfg.

    4. Open the zoo.cfg file using a text editor.

      1. Locate the dataDir property in line 12.
      2. Set its value to a folder of your choice.

        Example: dataDir=D:/zookeeper/dataDir

      3. At the end of the file, add the IP to which you want Zookeeper to listen.

        Example:

        clientPortAddress=192.168.168.68

        Otherwise Zookeeper will listen to 0.0.0.0:2181 by default.

      4. Save the file.
    5. Go to the <zookeeper_install_dir>\bin folder and start the zookeeper by executing the following from the command line:

      Windows:zkServer.cmd

      Linux:zkServer.sh start

      Now zookeeper is running at HTTP://<zookeeper_ip>:<zookeeper_port> (You can change the port in the zoo.cfg file).

  2. Install Solr in cloud mode. To do this follow these steps:

    1. Download Solr 6.2.1 distribution (http://archive.apache.org/dist/lucene/solr/6.2.1/) on a different machine from the zookeeper.

      Note

      Solr 6.2.1 requires JAVA 8.

      JAVA_HOME needs to be set as a system path or environment variable.

    2. Unzip the downloaded package.

    3. Create a directory where Solr is to be located and used as a running directory. You can call this directory <Solr_installDir>. Example: D:\Solr\6.2.1

      1. Copy the contents of the Solr package into this directory.

      2. Go to the <UCMDB_Server>\search\solr_dp directory and copy the solr.xml file and the configsets directory file to <Solr_installDir>.

    4. Start Solr in cloud mode:

      1. To start Solr in cloud mode, execute the following command from the bin folder:

        bin/solr start -cloud -s <Solr_installDir> -p 8987 -z <zookeeper_ip>:<zookeeper_port>

        Examples:

        solr start -cloud -s "D:\Solr\6.2.1\index\solr -p 9999 -z myzookeeper:2181
        solr start -cloud -s "D:\Solr\6.2.1\index\solr -p 9999 -z 16.66.166.166:2181

        Now Solr is started in cloud mode and it is connected to the zookeeper.

    5. On a different machine, install another Solr and connect to the zookeeper in the same way.

      After this you have a Solr cloud cluster up and running with 1 zookeeper and 2 Solr nodes.

    6. You can extend Solr cloud culster by adding more Solr machines to the zookeeper.

  3. Configure UCMDB for Solr cloud. To do this follow these steps:

    1. Go to the UCMDB server JMX console > UCMDB:service=Topology Search Services.
    2. Locate the setupSolrCloudConfiguration operation.
    3. Provide values for the parameters and make sure that the setup meets both of the following requirements:

      • numberOfShards * replicationFactor) % numberOfNodes == 0
      • numberOfShards * replicationFactor) / numberOfNodes == maxShardsPerNode
    4. Click Invoke.
    5. Restart UCMDB server.

      UCMDB server will create the index in Solr based on the configurations you provided in the JMX console.

    Note

Example

Below is an example of how the index will look like for a UCMDB with 2 customers with the following Solr cloud configuration:

Solr Cloud Configuration:
Number of nodes: 2
Number of shards: 2
Replication Factor: 2
Zookeeper URL: 16.66.166.166:2181
Is Solr Cloud enabled: true

You can see that the there are 2 indexes, one for each customer, customer1 and customer2.

Each index is split into 2 shards, with shard 1 being on the Solr machine 16.66.66.66:9999 and replicated on Solr machine 16.66.66.66:8888. Shard 2 is also present on both machines. So if a Solr machine shuts down, the index will still be available from the other one, and the users can still perform searches.