Over a million developers have joined DZone.

SolrCloud as a Windows Service

DZone's Guide to

SolrCloud as a Windows Service

· Big Data Zone ·
Free Resource

Hortonworks Sandbox for HDP and HDF is your chance to get started on learning, developing, testing and trying out new features. Each download comes preconfigured with interactive tutorials, sample data and developments from the Apache community.

Want to setup a simple solrCloud network on Windows? If you are just running a couple nodes and intend to run the embedded ZooKeeper here’s how to get it done.

First, make a list of the ip addresses (or better yet, hostnames) of your servers. You’ll need this for the ZooKeeper bit of the solr configuration.

Download a copy of Solr 4.3 or greater. Extract it somewhere reasonable on your first server. For simplicity we’ll assume C:\SolrCloud, if not find/replace in your favorite editor will be handy.

Next, grab the Apache Commons daemon for Windows. Unzip it somewhere off to the side. Inside you’ll find two executables: prunmgr and prunsrv. Copy prunmgr.exe to C:\SolrCloud and rename it to solrCloudw.exe. Do the same for prunsrv.exe, but name it solrCloud.exe (no “w” at the end of the name).

Open a command prompt (Start->Run then “cmd.exe” and enter).

cd C:\SolrCloud
Then, run the following to register your first server service:

A couple things to note here.

  1. Make sure to edit the line with “++JvmOptions=-DzkHost=;″. This should be a list of your servers with “:9983″ on the end of each. And, yes, you could supply a custom ZooKeeper root here by doing something like “:9983/myroot”. No need since we are running the embedded ZooKeeper, but who wants to do that forever?

  2. Check all the paths and make sure they reflect your setup. As mentioned, we are using “c:\SolrCloud” for simplicity.

  3. Don’t forget that we are writing logs to the C:\SolrCloud\example\logs directory. These can be very handy for trouble shooting.

  4. This setup will reset the the Solr config in ZooKeeper every time this server is restarted. You could remove this behavior by reregistering the service without the last line after it has run once. For now, I’d recommend keeping it until you are comfortable managing your own ZooKeeper servers. At that point you can drop the last for lines, and manage Zk as it’s on server/service.

Start the service:

solrCloud.exe //SS

Repeat the above on the rest of your servers, with one change. Remove the last line of the service setup, “++JvmOptions=-Dbootstrap_confdir=c:\SolrCloud\example\solr\conf”.

You now have a SolrCloud cluster running on Windows!

Thanks to Alexandre Rafalovitch and his article on Solr as a Windows Service. Have a look there if you want to run Solr on Windows, but not SolrCloud.

Hortonworks Community Connection (HCC) is an online collaboration destination for developers, DevOps, customers and partners to get answers to questions, collaborate on technical articles and share code examples from GitHub.  Join the discussion.


Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}