SolrCloud setup on Mac

May 09, 2017

By Chakravarthy Yeleswarapu

SolrCloud configuration – 2 shards X 2 replicas

  • Download Solr(see previous Solr 6.4.1 and unzip or untar to a directory.
  • I’ve installed Solr in my Mac’s home dir ~/solr-6.4.1
  • Ensure JDK 1.8 is available in your command line.
  • Check with java -version, Solr 6.x works only with JDK 1.8.
  • For this setup, I want to use ZK ensemble (instead of local ZK) just as we would in a production setup.

Start ZK nodes (see the previous post)

Create solr.home (not to be confused with install dir) for each node. I’m creating this in ~ dir as well.
SolrCloud-setup-on-Mac

Copy log4j.properties and solr.xml files to solr_home dirs
SolrCloud-setup-on-Mac

SolrCloud boot sequence – starting each node in numerical order.

SolrCloud-setup-on-Mac-1

Start node1 in cloud mode. Each step could be packed into .sh file

SolrCloud-setup-on-Mac-1

Following is boot sequence of node2, node3 & node4 in a single listing

SolrCloud-setup-on-Mac-1

At this point accessing http://localhost:8983/solr/#/~cloud  in the browser does not display ‘cloud’ configuration – because there are no collections created, yet.

Create techproducts collection.
SolrCloud-setup-on-Mac-1

Note the shards, replication facto,-d option for tech-products collection.
Accessing Solr console http://localhost:8983/solr/#/~cloud should display 2X2 setup.

SolrCloud-setup-on-Mac-1
Now, we are ready to index some data. I’ve used example docs that come with Solr install.

SolrCloud-setup-on-Mac-1

Using json.facet API, find top 5 categories and return a number of products in-stock and out-of-stock.

SolrCloud-setup-on-Mac-1

Note the formatting allowed by json.facet structure. Its clean, human readable, easy to understand & debug.

I’ve got above curl command working as is because –data-binary ‘<solr_query>’ allows indenting your input on the command line.

Contact us if your organization needs assistance with Solr search.

Explore Additional Resources

Learn how you can select the best Digital Experience platform for your business.

If you’d like to learn more about Adobe Experience Manager, visit our Adobe Practice.


GET HELP FROM OUR EXPERTS

Over the past 19 years, we have completed thousands of digital projects globally. We have one of the largest and deepest multi-solutions digital consulting teams in the world. Our proprietary processes and years of Digital Experience expertise have earned us a 97% customer satisfaction rating with our clients ranging from Global Fortune 1000 to Mid-Market Enterprises, leading educational institutions, and Non-Profits.

Contact us to know about how SAP FICO can make ledger management easier for you.

About TA Digital

TA Digital is an innovative digital transformation agency, specializing in delivering the digital experience, commerce, and marketing solutions. For nearly two decades, we have been helping traditional businesses transform and create dynamic digital cultures through disruptive strategies and agile deployment of innovative solutions.

Tags: