FactorPad
Faster Learning Tutorials

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.
by Paul Alan Davis, CFA, October 12, 2017
Updated: July 15, 2018
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 Next

~/ home  / tech  / solr  / reference  / solr healthcheck


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.

  • collection - the name of the collection
  • status - the health status of the SolrCloud instance
  • numDocs - the number of documents in the collection
  • numShards - the number of shards in the collection
  • shards - the details of each shard in the collection

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

  • shard - the name of the shard
  • status - the status of the shard
  • replicas - the details of each replica

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

  • name - the name of the node
  • url - the URL to the location of the node
  • numDocs - the number of documents in the replica
  • status - the status of the replica
  • uptime - the uptime of the replica
  • memory - the used and allocated memory of the node
  • leader - whether the replica is a leader or not, noted as true or false.

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. Subscribe here.

  • To see the outline of Solr reference material, click Outline.
  • To learn about the Solr status command, click Back.
  • To learn how to create cores and collections, click Next.

Outline Back Next

~/ home  / tech  / solr  / reference  / solr healthcheck



 
 
Keywords:
solr reference
apache solr
solr search
search for sites
website search engine
apache lucene
lucene reference
solr examples
solr commands
solr syntax
solrcloud
elasticsearch
solr healthcheck
google site search
solr settings
solr configuration
solr healthcheck man page