Build a Better Process

The Solr restart Command Syntax and Examples

This command incorporates actions from the stop and start commands so all of the parameters originally passed using start must also be used here as well.
  1. About - understand the purpose of the restart command.
  2. Syntax - see solr restart command usage from the command line.
  3. Options - view 12 options used with the solr restart command.
  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-restart.html

An ad-free and cookie-free website.

The Solr restart Command


The custom search space is geeting more crowded these days. Organizations are interested in third-party managed search offerings like Google Custom Search and Amazon CloudSearch, among others, for website search. Some are interested in more customization or enterprise search capabilities including binary document retrieval. This leads to the exploration of the Apache Lucene library and front-end tools like Apache Solr search and Elasticsearch.

During this evaluation, it is common to build a test environment on a local server and create indexes and run searches. A restart will be required from time to time. The solr restart command offers a fast way to stop the solr server and start with all of the same settings initially used with the start command.

Apache Solr Reference

1. About the solr restart command

The solr restart command will silently perform the stop and then start Solr with settings such as foreground or background, cloud or standalone mode, ports, configuration file directories, examples data sets and memory allocations. So it is a command that can save you time so you can get back to evaluating your enterprise search needs.

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

The solr restart command itself has 12 options, also known as parameters.

2. Syntax for the solr restart command

The syntax for running solr restart is as follows.

$ bin/solr restart [-f] [-c] [-h hostname] [-p port] [-d directory] [-z zkHost] [-e example] [-s solr.solr.home] [-t solr.data.home] [-a "additional-options"] [-V]

The list of 12 options including default values are explained in the table below, much like in a man page for Linux.

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.

If you are using a Solr Windows installation, the solr script is called using solr.cmd.

3. Options for the solr restart command

For the solr restart command all 12 options (parameters) are optional.

Syntax Purpose Default
bin/solr restart without options Restart Solr with default options.
  • background mode
  • -h localhost
  • -p 8983
  • -d server
  • -s solr
  • -m 512m
-f Restart Solr in the foreground. This cannot be paired with the -e option to open an example data set. Restart Solr in background mode
-c or -cloud Restart Solr in SolrCloud mode. It is common to also include the -z option. If -z is not supplied then a Zookeeper instance is restarted on the default port (8983) plus 1000, or 9983.
-h <host> Indicate a hostname for the Solr instance so HTTP requests can be sent through a browser to
http://<host>:<port> to access the Solr Admin User Interface.
-p <port> Set the port where Solr will listen for HTTP requests. Port 8983
-d <dir> Specify the location of the server directory where core configurations and indexes are stored. It is more common to adjust the -s option one step lower in the $SOLR_HOME/server/solr directory in some use cases. $SOLR_HOME/server
-z <zkHost> Connect to an existing Zookeeper instance when initiating with the -c or -cloud option in SolrCloud mode. Create a new embeded Zookeeper instance
-m <memory> Sets the minimum and maximum amount of memory allocated to the the Java Virtual Machine. Using one value sets both minimum (-Xms) and maximum (-Xmx) at the same level. Sizes are given in m for megabytes and g for gigabytes. 512m, or 512 megabytes
-s <dir> Initiates a system property called solr.solr.home which is where solr core directories are installed. Solr will look for a solr.xml file in that directory, unless one is located in Zookeeper. This is ignored when using -e to restart an example data set. $SOLR_HOME/server/solr
-e <example> Select the name of an example data set to restart. Currently there are four data sets.
  • cloud - for SolrCloud
  • techproducts - for an online technology products store
  • dih - for data import handlers
  • schemaless - Solr interprets a schema from the data
-a To pass additional parameters to the Java Virtual Machine on startup for more advanced setups. These are typically included within double quotes. None
-j To pass additional parameters to Jetty on startup for more advanced setups. These are typically included within double quotes. None
-noprompt Do not prompt for user input and accept defaults where interaction would otherwise be required. Prompt the user
-v Set verbose mode (DEBUG) for logging, common in a development environment. Log level set to INFO
-q Set quiet mode (WARN) for logging, common in a production environment where only warnings and errors are logged. Log level set to INFO
-V or -verbose Provide verbose messaging about actions taken from the bin/solr script. Run silent
-force To silence a warning message when Solr is restarted by the root user. Using root may cause issues. To exit with a warning

4. Examples of the solr restart command

Example 1 - Restart Solr with the techproducts example data set

The following command runs Solr with the example data set called techproducts including its default configuration files.

$ bin/solr restart -e techproducts
Example 2 - Restart Solr on a specified port number

The following command will restart Solr on port number 8984 instead of on the default 8983.

$ bin/solr restart -p 8984
Example 3 - Restart Solr while setting the hostname

The following command will restart Solr with the hostname set to search.example.com.

$ bin/solr restart -h search.example.com
Example 4 - Restart Solr with allocated memory of 2 Gigabytes

The following command will restart Solr with 2 Gigabytes of memory.

$ bin/solr restart -m 2g
Example 5 - Restart Solr with verbose messages

The following command will restart Solr with messages from the bin/solr script itself.

$ bin/solr restart -V
Example 6 - Print additional help on the solr restart command

From the command line you can access additional help on the bin/solr restart command by appending -help after the command.

$ bin/solr restart -help

Other Related Solr Content

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

What's Next?

Stay connected on YouTube, twitter and by email, whatever works best for you.

Outline Back Tip Next

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

solr restart
apache solr
solr reference
enterprise search
apache lucene
lucene reference
apache solr search
solr examples
solr commands
solr syntax
solr help
solr wiki
solr settings
solr configuration
man page

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