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.
Prerequisites
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/solr.in.sh
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:
SOLR_ZK_HOST="ld-xxxxx-proxy-zk.lindorm.rds.aliyuncs.com:2181/solr"
ld-xxxxx-proxy-zk.lindorm.rds.aliyuncs.com:2181/solr
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. 
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:
./solr
- 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, and2
is the number of shards. - View the collection.
./solr list_collections
- 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 namedconf
is automatically created in the current directory. This sub-folder stores the_indexer_default
configuration set. - 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 asmyConf
. - View the configuration set.
./solr zk ls /configs
- Create a collection based on the custom configuration set.
./solr create_collection -c myIndex -n myConf -shards 2