Solrcloud With Zookeeper -Single server setup

Getting Started with SolrCloud: A Beginner’s Guide for First-Time Users

If you’ve been diving into search technology and stumbled across SolrCloud, you might think it’s just Apache Solr hosted in the cloud. That’s a common misconception—but SolrCloud is much more powerful than that.

In this beginner-friendly guide, we’ll walk you through what SolrCloud actually is, why you might need it, and how to get it up and running on your local machine for development or testing.


 What is SolrCloud (and Why Should You Care)?

SolrCloud is the distributed, fault-tolerant, and scalable evolution of Apache Solr’s traditional architecture. While the original Solr relied on a master-slave model, SolrCloud is built for modern, large-scale applications that require high availability and real-time indexing.

 Key Benefits of SolrCloud:

  • High Availability: Replication ensures your data is always accessible—even if some nodes go down.

  • Scalability: Easily add new nodes as your indexing needs grow.

  • ZooKeeper Coordination: Handles configuration, failover, and cluster state management seamlessly.


 Tools & Versions Used in This Guide

To get started, you’ll need the following software :

  • Java: 11.0.25

  • ZooKeeper: 3.5.7

  • Apache Solr: 8.11.2

For a local setup, we’ll be simulating a cluster using three ZooKeeper nodes and two Solr nodes—all on one machine.
Note: In production, always use an odd number of ZooKeeper nodes to ensure quorum.


 Step-by-Step SolrCloud Setup on Windows

1. Install Java (OpenJDK 11)

  • Download and install Java 11.

  • Set your JAVA_HOME environment variable correctly.

2. Install NSSM (Non-Sucking Service Manager)

NSSM helps run Solr and ZooKeeper as Windows services.

  • Download NSSM from nssm.cc

  • Extract it to a directory of your choice


3. Set Up ZooKeeper Cluster (3 Nodes)

📁 Folder Structure

Create a directory structure like this:


D:\zookeeper\ ├── zookeeper-1\ ├── zookeeper-2\ └── zookeeper-3\

 Copy the extract Zookeeper 3.5.7  files into zookeeper-1 folder, then copy it twice and rename the copies to zookeeper-2 and zookeeper-3.Please check the screenshot mentioned below for better understanding.




4. Configure ZooKeeper Nodes

Step 1: Update zoo.cfg

Inside each node’s conf directory, copy zoo_sample.cfg → rename it to zoo.cfg. Then edit with node-specific values. For example, for zookeeper-1:

tickTime=3000 dataDir=D:\\zookeeper\\zookeeper-1\\data clientPort=2181 initLimit=5 syncLimit=5 server.1=localhost:2888:3888 server.2=localhost:2889:3889 server.3=localhost:2890:3890 4lw.commands.whitelist=mntr,conf,ruok


Note: update  clientport and datadir  value  specific to each node. Its always good to have separate client ports for each zookeeper node

The clientPort is the port on which Solr accesses ZooKeeper (default is 2181).

The parameters server.1, server.2, server.3, etc., are part of the Ensemble Configuration. These settings are necessary so that each node in the ensemble knows its own identity and the addresses of the other nodes.

In our case, the Ensemble Configuration is specified using hostnames in the configuration file. However, you can also configure it using IP addresses if preferred.

The ports used for communication between ZooKeeper nodes can be any ports you choose, but the default ports are 2888 (for follower connections) and 3888 (for leader election). 

.



 

 Step 2: Assign Node IDs

In each node’s dataDir, create a file named myid (no extension) and insert the corresponding number.Please check the screenshot mentioned below for better undersatnding

  • zookeeper-11

  • zookeeper-22

  • zookeeper-33



 Step 3: Open Firewall Ports

Allow ports 2181, 2182, and 2183 in Windows Firewall .In local dev environment I hope you do not need to worry as it worked for me.

You can test connectivity with PowerShell:


Test-NetConnection localhost -Port 2181

5. Start ZooKeeper Using NSSM

Navigate to the NSSM executable directory in cmd proppt as admin:

D:\Chandan\Zookeeper-3.5.7\nssm-2.24\win64

Run the below command

nssm install zookeeper1


on the execution of the above command you will get NSSM popup








 Point the path variable to the zkServer.cmd script for each ZooKeeper node. After installing all three nodes, restart your system and check Windows Services to ensure they’re running.

Note: If you have completed the setup of only one ZooKeeper node and try to run it as a Windows service, it will not work. At least two out of three nodes must be running at the same time to form a majority quorum. First-time users often get stuck here, thinking there's an issue with the setup. So, make sure to install all three nodes as Windows services and then restart your system..







Setting Up  SolrCloud with Standalone Solr:

In the context of this blog, I have two standalone Solr instances running on port numbers 8983 and 8985. Both are sharing the same self-signed certificate, and the domain is set to localhost. Since both Solr instances are running on localhost, they are able to use the same certificate. I’m assuming you’re already familiar with how to set up a standalone Solr instance with HTTPS enabled. 

1. Configure solr.in.cmd in both the solr instance node

Update the ZK_HOST variable in each Solr node’s solr.in.cmd:


ZK_HOST=localhost:2181,localhost:2182,localhost:2183

Then restart the Solr services.


2. Enable SSL for ZooKeeper Ensemble

On one of your Solr servers, run the following command to set https as the cluster's URL scheme:

Performs the configuration of a Zookeeper ensemble to use SSL when talking to Solr. Run the below command from any of the Solr servers (doesn't require to run on each zookeeper server.).This step should be  executed on anyone of the solr instance .Please avoid repeating


cd D:\Solr\solr-newsolr-8.11.2\server\scripts\cloud-scripts zkCli.bat -zkhost "localhost:2181,localhost:2182,localhost:2183" -cmd clusterprop -name urlScheme -val https


3. Access Solr Admin UI

Head over to:


https://localhost:8983/solr



https://localhost:8985/solr



You should see your SolrCloud cluster up and running, including nodes, shards, and ZooKeeper details.

 Creating Solr Collections

 Now we are done with solr cloud setup with zookeeper. Now to create collection .Please refer to Sitecore documentation which is very simple. 

Go through the below links to create index 

 Useful Reading & Next Steps

  • [Sitecore SolrCloud Setup Guide]

  • [xConnect with SolrCloud]



Comments

Popular posts from this blog

Render Sitecore Experience Forms Using Sitecore XP 10.4 with a Headless Approach (Next.js + JSS SDK)

Next.js with XM Cloud EDGE and GraphQL