You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by "Hoss Man (Confluence)" <co...@apache.org> on 2013/07/16 20:47:00 UTC

[CONF] Apache Solr Reference Guide > Command Line Utilities

Space: Apache Solr Reference Guide (https://cwiki.apache.org/confluence/display/solr)
Page: Command Line Utilities (https://cwiki.apache.org/confluence/display/solr/Command+Line+Utilities)

Change Comment:
---------------------------------------------------------------------
SOLR-4972 - put command

Edited by Hoss Man:
---------------------------------------------------------------------
Solr's Administration page (found by default at [http://hostname:8983/solr/admin]), provides a section with menu items for monitoring indexing and performance statistics, information about index distribution and replication, and information on all threads running in the JVM at the time. There is also a section where you can run queries, and an assistance area.

In addition, SolrCloud provides its own administration page (found by default at [http://localhost:8983/solr/#/~cloud]), as well as a few tools available via ZooKeeper's Command Line Utility (CLI). The CLI lets you upload configuration information to ZooKeeper, in the same two ways that were shown in the examples in [solr:Parameter Reference]. It also provides a few other commands that let you link collection sets to  collections, make ZooKeeper paths or clear them, and download configurations from ZooKeeper to the local filesystem.

h2. Using The ZooKeeper CLI

ZooKeeper has a utility that lets you pass command line parameters: {{zkcli.bat}} (for Windows environments) and {{zkcli.sh}} (for Unix environments).

h3. {{zkcli}} Parameters

The {{zkcli}} command takes the form {{\-cmd <arg>}} where the command to run can be {{bootstrap}}, {{upconfig}}, {{downconfig}}, {{linkconfig}}, {{makepath}}, {{put}} or {{clear}}.

|| Parameter || Usage || Meaning ||
| \-c | \-collection <arg> | For {{linkconfig}}: name of the collection. |
| \-d | \--confdir <arg | For {{upconfig}}: a directory of configuration files. |
| \-h | \--help | Bring up the help page. |
| \-n | \--confname <arg> | For {{upconfig}}, {{linkconfig}}: name of the configuration set. |
| \-r | \--runzk <arg> | Run ZooKeeper internally by passing the Solr run port; only for clusters on one machine. |
| \-s | \--solrhome <arg> | For bootstrap, {{runzk: solrhome}} <location>. |
| \-z | \--zkhost <arg> | ZooKeeper host address. This parameter is *mandatory* for all CLI commands. |

h2. ZooKeeper CLI Examples

Below are some examples of using the {{zkcli}} CLI:

h3. Uploading a Configuration Directory

{code:borderStyle=solid|borderColor=#666666}
java -classpath example/solr-webapp/WEB-INF/lib/*
     org.apache.solr.cloud.ZkCLI -cmd upconfig -zkhost 127.0.0.1:9983
     -confdir example/solr/collection1/conf -confname conf1 -solrhome  example/solr
{code}

h3. Put arbitrary data into a new file

{code:borderStyle=solid|borderColor=#666666}
java -classpath example/solr-webapp/WEB-INF/lib/*
     org.apache.solr.cloud.ZkCLI -zkhost 127.0.0.1:9983 -put /data.txt 'some data'
{code}


h3. Linking a Collection to a Configuration Set

{code:borderStyle=solid|borderColor=#666666}
java -classpath example/solr-webapp/webapp/WEB-INF/lib/*
     org.apache.solr.cloud.ZkCLI -cmd linkconfig -zkhost 127.0.0.1:9983
     -collection collection1 -confname conf1 -solrhome example/solr
{code}

h3. Bootstrapping All the Configuration Directories in {{solr.xml}}

{code:borderStyle=solid|borderColor=#666666}
java -classpath example/solr-webapp/webapp/WEB-INF/lib/*
     org.apache.solr.cloud.ZkCLI -cmd bootstrap -zkhost 127.0.0.1:9983
     -solrhome example/solr
{code}

h3. Scripts

There are scripts in {{example/cloud-scripts}} that  handle the classpath and class name for you if you are using Solr out of the box with Jetty. Commands then become:

{code:borderStyle=solid|borderColor=#666666}
sh zkcli.sh -cmd linkconfig -zkhost  127.0.0.1:9983
     -collection collection1 -confname conf1 -solrhome example/solr
{code}

{scrollbar}


Stop watching space: https://cwiki.apache.org/confluence/users/removespacenotification.action?spaceKey=solr
Change email notification preferences: https://cwiki.apache.org/confluence/users/editmyemailsettings.action