FactorPad
Build a Better Process

The Solr healthcheck Command Syntax and Examples

This command applies only to SolrCloud mode for distributed search, so the focus is on collections instead of cores.
  1. About - understand the purpose of the healthcheck command.
  2. Syntax - see solr healthcheck command usage from the command line.
  3. Options - view 2 options used with the solr healthcheck command and items in the JSON healthcheck report.
  4. Examples - review several common examples including additional help.
face pic by Paul Alan Davis, CFA
Updated: February 24, 2021
Here we focus on the command line using a Linux-based operating system, however many of the same commands work for macOS. There are slight differences for Windows.

Outline Back Tip Next

/ factorpad.com / tech / solr / reference / solr-healthcheck.html


An ad-free and cookie-free website.


The solr Healthcheck Command

Beginner

Developing capabilities in the search for sites space can get confusing. Offerings include a managed SAAS search offering like Google custom search or Amazon CloudSearch, among others. Others prefer to build custom search a solr web offering or Elasticsearch search capabilities on top of Apache Lucene libraries.

Either way, search is moving to the cloud and Apache SolrCloud offering is what sits behind many offerings, so getting up to speed with how search in the cloud is managed is a necessity. The solr healthcheck command offers a fast way to see all of the different nodes, shards, replicas and collections so you can monitor the health of your SolrCloud search service quickly.

Apache Solr Reference

1. About the solr healthcheck command

The solr healthcheck command will report on all active collections on the SolrCloud server as specified by collection or by host and port number.

The solr healthcheck command is one of 12 commands within the main solr script.

The solr healthcheck command itself has 2 options, also known as parameters.

2. Syntax for the solr healtcheck command

The syntax for running solr healthcheck is as follows.

$ bin/solr healthcheck [-c collection] [-z zkHost]

The list of 2 options including default values are explained in the table below.

This syntax assumes your current working directory is the $SOLR_HOME directory for Solr, which for version 7 would be ~/solr-7.0.0/ in standalone mode for a local installation. When running in a production environment the directory locations may differ.

So the path to the location of the solr script is: ~/solr-7.0.0/bin/solr. Alternatively, the solr script can be run using the convention ./solr from within the bin directory.

When using Windows, the solr script is called using solr.cmd.

3. Options for the solr healthcheck command

For the solr healthcheck command the -c <collection> option (parameters) is required. Other options are optional.

Syntax Purpose Default
-c <collection> Print a JSON-formatted report on a SolrCloud collection. A collection is required
-z <zkHost> Connect to an existing Zookeeper instance in SolrCloud mode. ZooKeeper instances are often started on the default port (8983) plus 1000, or 9983. localhost:9983
Items reported in the healthcheck report

Below is a list of items reported in JSON format when using the bin/solr healthcheck command in SolrCloud mode on the collection specified.

For each shard identified above the healthcheck provides the following information.

For each replica the following information is reported in JSON format.

4. Examples of the solr healthcheck command

Example 1 - Run a basic Solr healthcheck

The following command will run a healthcheck on an established and running SolrCloud instance with a collection named mycollection.

$ bin/solr healthcheck -c mycollection
Example 2 - Run a Solr healthcheck on a ZooKeeper instance

The following command runs a healthcheck on a collection called mycollection on a non-default port 9984.

$ bin/solr healthcheck -c mycollection -z 9984
Example 3 - Print additional help on the solr healthcheck command

From the command line you can access additional help on the Solr healthcheck command by appending -help after the command.

$ bin/solr healthcheck -help

Other Related Solr Content

FactorPad offers Apache Solr Search content in both tutorials and reference.


What's Next?

The learning never stops, please join us at our YouTube Channel and follow @factorpad.

Outline Back Tip Next

/ factorpad.com / tech / solr / reference / solr-healthcheck.html


solr healthcheck
apache solr
solr reference
enterprise search
apache Lucene
lucene reference
apache solr search
solr examples
solr commands
solr syntax
solr help
solr wiki
solrcloud
solr settings
solr configuration
solr man page

A newly-updated free resource. Connect and refer a friend today.