Never mind. I figured it out. It was due to a NPE on the missing updateLog in 
solrconfig.xml. My solrconfig.xml is from an older Solr release, which doesn't 
have certain required sections, etc. After adding them to solrconfig.xml per 
this official doc, everything started to work.

http://wiki.apache.org/solr/SolrCloud#Required_Config


Regards,
HaiXin




On 09/16/2013 04:55 PM, HaiXin Tie wrote:
Sorry but I've fixed some typos, updated text:

Hello Solr experts,

For some strange reason, collection alias does not work in my Solr instance 
when more than one collection is used. I would appreciate your help.

# Here is my setup, which is quite simple:
Zookeeper: 3.4.5 (used to upconfig/linkconfig collections and configs for c1 
and c2)
Solr: version 4.4.0, with two collections c1 and c2 (solr.xml included) created 
using remote core API calls

# Symptoms:
1. Solr queries to each individual collection works fine:
   http://localhost:8983/solr/c1/select?q=*:*
   http://localhost:8983/solr/c2/select?q=*:*
2. CREATEALIAS name=cx for c1 or c2 alone (e.g. 1-1 mapping) works fine:
   http://localhost:8983/solr/cx/select?q=*:*
3. CREATEALIAS name=cx for c1 and c2 does not work:

   # Solr request/response to the collection alias (success):
   curl -s 
"http://localhost:8983/solr/admin/collections?action=CREATEALIAS&name=cx&collections=c1,c2";<http://localhost:8983/solr/admin/collections?action=CREATEALIAS&name=cx&collections=c1,c2>
   <?xml version="1.0" encoding="UTF-8"?>
   <response>
   <lst name="responseHeader"><int name="status">0</int><int 
name="QTime">134</int></lst>
   </response>

   # Solr query using the alias fails with Error 503: "no servers hosting shard"
   http://localhost:8983/solr/cx/select?q=*:*
   <response><lst name="responseHeader"><int name="status">503</int><int name="QTime">2</int><lst name="params"><str 
name="q">*:*</str></lst></lst><lst name="error"><str name="msg">no servers hosting shard: </str><int name="code">503</int></lst></response>


# Solr logs:
3503223 [qtp724646150-11] ERROR org.apache.solr.core.SolrCore  ? 
org.apache.solr.common.SolrException: no servers hosting shard:
   at 
org.apache.solr.handler.component.HttpShardHandler$1.call(HttpShardHandler.java:149)
   at 
org.apache.solr.handler.component.HttpShardHandler$1.call(HttpShardHandler.java:119)
   at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
   at java.util.concurrent.FutureTask.run(FutureTask.java:138)
   at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
   at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
   at java.util.concurrent.FutureTask.run(FutureTask.java:138)
   at 
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
   at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
   at java.lang.Thread.run(Thread.java:662)

3503224 [qtp724646150-11] INFO  org.apache.solr.core.SolrCore  ? [c1] 
webapp=/solr path=/select params={q=*:*} status=503 QTime=2

# solr.xml
<?xml version="1.0" encoding="UTF-8" ?>
<solr persistent="true" sharedLib="lib">
 <cores host="${host:}" adminPath="/admin/cores" hostPort="${jetty.port:}" 
hostContext="${hostContext:solr}">
   <core shard="shard1" instanceDir="c1/" name="c1" collection="c1"/>
   <core shard="shard1" instanceDir="c2/" name="c2" collection="c2"/>
 </cores>
</solr>

# zookeeper alias (same from solr/cloud UI):
[zk: localhost:2181(CONNECTED) 10] get /myroot/aliases.json
{"collection":{
   "cx":"c1,c2"}}
cZxid = 0x110d
ctime = Fri Sep 13 17:25:18 PDT 2013
mZxid = 0x18d1
mtime = Mon Sep 16 16:31:21 PDT 2013
pZxid = 0x110d
cversion = 0
dataVersion = 19
aclVersion = 0
ephemeralOwner = 0x0
dataLength = 119
numChildren = 0

BTW, I've spent a lot of time figuring out how to make zookeeper and solr work 
together. The commands are not complex, but making them work sometimes requires 
a lot of digging online, to figure out missing jars for zkCli.sh, etc. I know a 
lot of things are changing since Solr 4.0, but I really hope the Solr 
documentation can be better maintained, so that people won't have to spend tons 
of hours figuring out simple steps (albeit complex under the hood) like this. 
Thanks!



________________________________

This email and any attachments may contain confidential and privileged material 
for the sole use of the intended recipient. Any review, copying, or 
distribution of this email (or any attachments) by others is prohibited. If you 
are not the intended recipient, please contact the sender immediately and 
permanently delete this email and any attachments. No employee or agent of TiVo 
Inc. is authorized to conclude any binding agreement on behalf of TiVo Inc. by 
email. Binding agreements with TiVo Inc. may only be made by a signed written 
agreement.

Reply via email to