Solr Landr is a command line interface on top of SolrJ to interact with any accessible SolrCloud cluster.
TODO
Code formatting can be validated with ./gradlew spotlessCheck and enforced with ./gradlew splotlessApply. Ideally, the code should always be re-formatted before commiting.
TODO: review
Once successfully built, the shell script run.sh can be executed in root folder to start the tool. By default, the tool will look for a Zookeeper ensemble on localhost. This can be configured with parameters -zkhost and -zkroot.
Example 1: start the command line with Zookeeper running on localhost with default port, and no chroot:
./run.sh
Example 2: start the command line with Zookeeper running on a remote server, with a configured chroot:
./run.sh -zkhost remote:2181 -zkroot /solr
Complete list of parameters can be obtained by running ./run.sh -help.
Pragmas are special statements that are internal to the Solr client. All pragmas are executed with special syntax @pragma [params…]
For commands that refer to a specific collection, the collection parameter can also be implicitly specified using @context pragma.
Create a new collection in the SolrCloud cluster. Parameter name is required, but it can also be implicitly specified using @context pragma.
Syntax: create-collection -name name [-shards shards] [-replicas replicas] [-type type] [-config config]
Delete an existing collection from the SolrCloud cluster. Parameter name is required, but it can also be implicitly specified using @context pragma.
Syntax: delete-collection -name name
Delete all existing collections from the SolrCloud cluster. This command accepts no parameters.
Create a collection snapshot.
Syntax: backup -collection collection -name name [-repository repository] [-location location] [-async async]
Split a shard into two new sub-shards. The original shard is not removed and remains with inactive status.
Syntax: split-shard -collection collection -shard shard
Add a new replica to a shard.
Syntax: add-replica -collection collection -shard shard [-type type]
Deletes a named replica from the specified collection and shard.
Syntax: delete-replica -collection collection -shard shard -replica replica
Following is the list of supported commands to interact directly with the Zookeeper ensemble. This is done with a client directly connecting to Zookeeper, which is independent of the one used by Solr client. Solr command and Zookeeper commands use independent sessions. There is no guarantee that the changes done with Zookeeper commands will not break the SolrCloud cluster.
zk-ls path: List the child nodes of specified node.
zk-get path Get the data from node at the specific path.
zk-stat path: Get metadata of a node including version, number of children, creation/modification timestamps, type (persistent/ephemeral), and data length.
zk-create path [-mode mode] Create a new Zookeeper node. By default, creates a persistent node when mode is not specified. Accepted modes are values from Zookeeper CreateMode enum.
zk-delete path Delete a node at specific path.