Support Questions
Find answers, ask questions, and share your expertise
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Solr Collection Node from command line


Solr Collection Node from command line


I am working on 20 node cluster. I created a solr collection in Cloudera using the solrctl command (instancedir, collection etc) with single shard.


In the Solr Admin page I could see my collection and get its node address.

I am not sure how to get the Solr Collection node from command line or any other way other than Solr Admin page.


I have program which indexes the solr, and its needs the collection node address along with collection name.



Appreciate your help in this regard.


Re: Solr Collection Node from command line




If you are using Cloudera and Hue then you don't need to use commands like instancedir, collection in CLI. Just enable solr in Hue. so that you can create Index and Dash board in hue itself without the commands that you have mentioned


1. Go to CM -> Hue -> Configuration -> search (Solr Service) -> select Solr

2. Search (Snippet) and Add the following line under “ Hue Server Configuration Advanced Configuration Snippet for hue_safety_valve_server.ini “

## URL of the Solr Server

3. Restart Hue service and login to hue. You will see a new menu called "Search". It will allow you to create Index, dashboard





Re: Solr Collection Node from command line

Super Collaborator
Additionally, from any SOLR UI, you should be able to see a list of all configured instances, and what hosts they are running on. That solr UI is available on each solr host, usually on port 8983:

The list of collections is under the Cloud->Graph view

Re: Solr Collection Node from command line


Thanks for the response.

This is how I was doing when I created the index using Hue and don't have issue in creating/viewing Solr indexes using UI page.

I am also fine with creating the solr collection in command line and can getting the Solr collection node address from the Solr Admin UI.


The issue is I have a spark/scala program which push the data into Solr using org.apahce.sorl.SolrJ api. This program is build for single shard collection using HttpSolrServer class not using CloudSolrServer class. So for HttpSolrServer I need to pass the Solr Collection address for indexing. Hence I want an way to get the Solr collection Node address automtically (not manually using Solr Admin page)

Re: Solr Collection Node from command line

Super Collaborator

The "CloudSolrServer" implementation is here to acheive what you ask for.


If you use the "HttpSolrServer", you cannot know which SolrServer is hosting your collection (except if you programaticaly get this information yourself. This information is stored in ZK.).

But you should be able to access any Solr server part of the SolrCloud cluster (then Solr will redirect the query internally).


Most of the time, if you use "HttpSolrServer" it is for using a loadbalancer in front of Solr.



Don't have an account?
Coming from Hortonworks? Activate your account here