You can use a shell to access the search engine service provided by ApsaraDB for Lindorm (Lindorm). The search engine service is called LindormSearch. This topic describes how to use the Apache Solr shell to access LindormSearch.


LindormSearch is activated. For more information about how to activate the LindormSearch service, see Activate the LindormSearch service.

Download the compressed package for the Apache Solr shell

Download the package for the Apache Solr shell. Then, run the following command to extract the package:

tar -zxvf lindorm-search-tool.tar.gz         

Configure the database connection information

In the lindorm-search-tool/conf/ file, remove the number sign (#) in front of SOLR_ZK_HOST to uncomment the code and modify the following code, as shown in the following code block:

Replace with the private endpoint that is used to connect to your database. To view the private endpoint, log on to the Lindorm console and choose Instance List > Database Connection > Search Engine. Then, on the Search Engine tab, you can view the private endpoint. Endpoint
Note In the preceding configuration example, SOLR_ZK_HOST specifies the private endpoint. LindormSearch cannot be accessed over the Internet.

Sample code to use the Apache Solr shell to access LindormSearch

Go to the lindorm-search-tool/bin path and run the following command to view the help commands:

  1. Create a collection.
    ./solr create_collection -c testIndex -n _indexer_default -shards 2            

    testIndex is the name of the index, _indexer_default represents the default configuration set, and 2 is the number of shards.

  2. View the collection.
    ./solr list_collections                
  3. Run the following command to download the configuration set:
    ./solr zk downconfig -d . -n _indexer_default                
    Note _indexer_default represents the default configuration set that is provided by LindormSearch. After you run the preceding command, a sub-folder named conf is automatically created in the current directory. This sub-folder stores the _indexer_default configuration set.
  4. Upload the configuration set.
    ./solr zk upconfig -d conf -n myConf                  
    Note You can change the configuration set name to a name of your custom configuration set, such as myConf.
  5. View the configuration set.
    ./solr zk ls /configs                   
  6. Create a collection based on the custom configuration set.
    ./solr create_collection -c myIndex -n myConf -shards 2