Support Questions
Find answers, ask questions, and share your expertise

collection aliasing implementation




I am using solr with cloudera distribution to index data from hdfs and I am using "solrctl" utility for collection creation. Now i wanted to create collection alias for maintaining two sets of indexes , one for current data and the other for history data. How can i acheive this by creating aliases? I read that collection alias will point to different collections at different times, how can we implement this particular phrase.


Please help me on this.


Re: collection aliasing implementation

Super Collaborator

Alias creation is made through the rest API of Solr. You cannot do it using solrctl utility.


A sample using SH :

curl "http://<ip_of_one_Solr_Server>/solr/admin/collections?action=CREATEALIAS&name=<Alias_name>&collections=<TargetCollectionName>


Re: collection aliasing implementation

Cloudera Employee

Re: collection aliasing implementation

Hi, I have kerberos security enabled on my cluster. The curl command mentioned throws me a connection refused error message. 


<html><head><title>Apache Tomcat/6.0.44 - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;} {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 401 - Authentication required</h1><HR size="1" noshade="noshade"><p><b>type</b> Status report</p><p><b>message</b> <u>Authentication required</u></p><p><b>description</b> <u>This request requires HTTP authentication.</u></p><HR size="1" noshade="noshade"><h3>Apache Tomcat/6.0.44</h3></body></html>[v4s80mb@vllxbddev01 ~]


I added the invocation of jaas-client.conf file (storing the kerberos principle and user) and then invoked. Upon execution the curl, I got the following. 


<lst name="responseHeader"><int name="status">400</int><int name="QTime">1</int></lst><lst name="error"><str name="msg">Missing required parameter: name</str><int name="code">400</int></lst>


Could anybody help

Re: collection aliasing implementation

Hi All, I have an alias created for reading the index. I tried looking into the alias in the Solr web UI and only saw it in /aliases.json file. Currently the client is accessing solr via http://mysolrserver:8983/solr/#/collectionname/query but how do I access the collectionalias. when I try to use http://mysolrserver:8983/solr/#/collectionalias/query it throws me the following error


"There exists on core with the name "collectionalias". 


That raises the question, how do I access by collection via the alias?


I'm planning on implemention collectionalias for re-indexing to have a read-only alias while another collection is getting the updates. 


Appreciate any help. 



Re: collection aliasing implementation

Super Collaborator

Hi Venkat,


If your cluster is secured by Kerberos you need to supply a valid keytab for the unix user running the curl command.


As for the second question you can't "administer" an alias like the Solr web UI enables you with a collection.

You need to access the alias with the real URL.


It should looks like this : http://<server_host>:<server_port>/solr/<aliasname>/select?q=<yourquery>

Re: collection aliasing implementation

Super Collaborator

As an additional point to the previous comment, if you have kerberos enabled, be sure to kinit, and then use the '--negotiate -u :' options for curl to send the kerberos ticket.



Re: collection aliasing implementation

Thank you for your help. It worked for me. I've included the curl with negotiate to capture into a tokenfile and used it before the indexing process.