This is the documentation for CDH 5.0.x. Documentation for other versions is available at Cloudera Documentation.

Solrctl Reference

Use the solrctl utility to manage a SolrCloud deployment, completing tasks such as manipulating SolrCloud collections, SolrCloud collection instance directories, and individual cores.

A SolrCloud collection is the top level object for indexing documents and providing a query interface. Each SolrCloud collection must be associated with an instance directory, though note that different collections can use the same instance directory. Each SolrCloud collection is typically replicated (also known as sharded) among several SolrCloud instances. Each replica is called a SolrCloud core and is assigned to an individual SolrCloud node. The assignment process is managed automatically, though users can apply fine-grained control over each individual core using the core command. A typical deployment workflow with solrctl consists of deploying ZooKeeper coordination service, deploying solr-server daemons to each node, initializing the state of the ZooKeeper coordination service using init command, starting each solr-server daemon, generating an instance directory, uploading it to ZooKeeper, and associating a new collection with the name of the instance directory.

In general, if an operation succeeds, solrctl exits silently with a success exit code. If an error occurs, solrctl prints a diagnostics message combined with a failure exit code.

You can execute solrctl on any node that is configured as part of the SolrCloud. To execute any solrctl command on a node outside of SolrCloud deployment, ensure that SolrCloud nodes are reachable and provide --zk and --solr command line options.

The solrctl commands init, instancedir, collection, core, and cluster affect the entire SolrCloud deployment and are executed only once per required operation.

The solrctl core command affects a single SolrCloud node.

If you are using solrctl to manage your deployment in an environment that requires Kerberos authentication, you must have a valid Kerberos ticket, which you can get using kinit.

Syntax

You can initialize the state of the entire SolrCloud deployment and each individual node within the SolrCloud deployment using solrctl. The general solrctl command syntax is of the form:

solrctl [options] command [command-arg] [command [command-arg]] ...

Each part of these elements and their possible values are described in the following sections.

Options

If options are provided, they must precede commands:
  • --solr solr_uri: Directs solrctl to a SolrCloud web API available at a given URI. This option is required for nodes running outside of SolrCloud. A sample URI might be: http://node1.cluster.com:8983/solr.
  • --zk zk_ensemble: Directs solrctl to a particular ZooKeeper coordination service ensemble. This option is required for nodes running outside of SolrCloud. For example: node1.cluster.com:2181,node2.cluster.com:2181/solr.
  • --help: Prints help.
  • --quiet: Suppresses most solrctl messages.

Commands

  • init [--force]: The init command, which initializes the overall state of the SolrCloud deployment, must be executed before starting solr-server daemons for the first time. Use this command cautiously as it is a destructive command that erases all SolrCloud deployment state information. After a successful initialization, it is impossible to recover any previous state.
  • instancedir [--generate path] [--create name path] [--update name path] [--get name path] [--delete name] [--list]: Manipulates the instance directories. The following options are supported:
    • --generate path: Allows users to generate the template of the instance directory. The template is stored at a given path in a local filesystem and it has the configuration files under /conf. See Solr's README.txt for the complete layout.
    • --create name path: Pushes a copy of the instance directory from local filesystem to SolrCloud. If an instance directory is already known to SolrCloud, this command fails. See --update for changing name paths that already exist.
    • --update name path: Updates an existing SolrCloud's copy of an instance directory based on the files present in a local filesystem. This can be thought of us first using --delete name followed by --create name path.
    • --get name path: Downloads the named collection instance directory at a given path in a local filesystem. Once downloaded, files can be further edited.
    • --delete name: Deletes the instance directory name from SolrCloud.
    • --list: Prints a list of all available instance directories known to SolrCloud.
  • collection [--create name -s <numShards> [-c <collection.configName>] [-r <replicationFactor>] [-m <maxShardsPerNode>] [-n <createNodeSet>]] [--delete name] [--reload name] [--stat name] [--list] [--deletedocs name]: Manipulates collections. The supported options have the following purpose:
    • --create name -s <numShards> [-c <collection.configName>] [-r <replicationFactor>] [-m <maxShardsPerNode>] [-n <createNodeSet>]]: Creates a new collection name that is sharded to <numShards> SolrCloud nodes, is configured using <collection.configName> instance directory, replicated to a factor of <replicationFactor> has a maximum shards per node of <maxShardsPerNode>, and is allocated to <createNodeSet> set of nodes. The only required parameters are name and numShards. If collection.configName is not given, it is assumed to be the same as the name of the collection.
    • --delete name: Deletes a collection.
    • --reload name: Reloads a collection.
    • --stat name: Outputs SolrCloud specific run-time information for a collection.
    • --list: Lists all collections registered in SolrCloud.
    • --deletedocs name: Purges all indexed documents from a collection.
  • core [--create name [-p name=value]...] [--reload name] [--unload name] [--status name]: Manipulates cores. This is one of the two commands that you can execute on a particular SolrCloud node. Use this expert command with caution. The following options are supported:
    • --create name [-p name=value]...]: Creates a new core on a given SolrCloud node. The core is configured using name=values pairs. For more details on configuration options see Solr documentation.
    • --reload name: Reloads a core.
    • --unload name: Unloads a core.
    • --status name: Prints status of a core.
  • cluster [--get-solrxml file] [--put-solrxml file]: Manages cluster configuration. The following options are supported:
    • --get-solrxml file: Downloads the cluster configuration file solr.xml from ZooKeeper to the local system.
    • --put-solrxml file: Uploads the specified file to ZooKeeper as the cluster configuration file solr.xml.
Page generated September 3, 2015.