Skip to main content
SumitraMenon
Silver ⭐️
Silver ⭐️
Dec 10, 2019 4:14 PM UTC

Support Video: How to list/ create/ delete collections from Ambari-Infra-Solr using APIs?

  • Oct 5, 2026 8:58 AM UTC
  • 0 replies
  • 3945 views
  • Translate All

Many a times, it is necessary for a engineer/administrator to manipulate the content of Ambari-Infra-Solr using the command line utilities. They might or might not have access to the GUI interface.

 

This video helps to understand the basic manipulation of:

  • Listing collections and checking cluster status of Solr cloud.
  • Creating new collections.
  • Deleting the existing collections.

 

  1. To check if ambari-infra-solr server instance is running on the node, run the following:

    # ps -elf | grep -i infra-solr
    # netstat -plant | grep -i 8886

  2. If the cluster is Kerberized. Check for valid kerberos tickets:

    # klist -A

  3. Obtain a kerberos ticket, if not present:

    # kinit -kt /etc/security/keytabs/ambari-infra-solr.service.keytab
    $(klist -kt /etc/security/keytabs/ambari-infra-solr.service.keytab
    |sed -n "4p"|cut -d ' ' -f7)

  4. List SOLR collections:

    curl --negotiate -u : "http://$(hostname -f):8886/solr/admin/collections?action=list"

  5. Create a collection:

    # curl --negotiate -u : "http://$(hostname -f):
    8886/solr/admin/collections?action=CREATE&name=<collection_name>&numShards=<number>"

  6. The following are the optional Values:

    &maxShardsPerNode=<number>
    &replicationFactor=<number>

  7. Delete a collection: 

    # curl --negotiate -u : "http://$(hostname -f):
    8886/solr/admin/collections?action=DELETE&name=collection"

  8. Check status of the Solr Cloud cluster:

    # curl --negotiate -u : "http://$(hostname -f):
    8886/solr/admin/collections?action=clusterstatus&wt=json" | python -m json.tool

  9. INDEX Keys:

    *solr_host = Host where solr instance(s) is running.
    *collection = Name of collection.
    *shard = Name of shard.
    *action = CREATE ( to add a collection(s) )
    *action = DELETE ( to delete a collection(s) )
    *action = CLUSTERSTATUS ( to get the list of available collection(s) in the Solr cloud cluster )