Community Articles

Find and share helpful community-sourced technical articles.
Announcements
Celebrating as our community reaches 100,000 members! Thank you!
Labels (2)
avatar
Community Manager

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 )
2,614 Views
0 Kudos