Updated on 2024-11-29 GMT+08:00

Using Solr from Scratch

This section describes how to use Solr from scratch, update the client configuration file on the primary management node of the cluster, create collections, delete collections, and view existing collections on the client.

Prerequisites

The cluster runs properly and the Solr client has been installed in a directory, for example, /opt/client. The client directory in the following operations is only an example. Change it based on the actual installation directory onsite.

Procedure

  1. Use the client.

    1. Log in to the node where the client resides as the client installation user and run the following command to switch to the client directory:

      cd /opt/client

    2. Run the following command to configure environment variables:

      source bigdata_env

    3. If Kerberos authentication has been enabled for the current cluster, run the following command to authenticate the current user. The current user must have Solr permissions. If Kerberos authentication is disabled for the current cluster, skip this step:

      kinit MRS cluster user

      Example: kinit solruser

  2. Run the Solr client command.

    1. Create a collection

      solrctl collection --create col_filter_1 -c confWithSchema -s 3 -r 2 -m 2

    2. Delete a collection.

      solrctl collection --delete col_filter_1

    3. Run the following statement to check the existing collection:

      solrctl collection --list