I think I see the confusion.  Erick is right that using collections API
would sort the problem, but here is my rationale on why the confusion
exists.

There are 3 stages to creating a valid collection (well this is how I think
of it)

1) Upload a solrconfig.xml/schema.xml (+ A N Other required config) to ZK,
2) Create the "logical" collection, this step is dividing up the hash range
of unique Ids for the shards, and needs to know NumShards for the
collection in order to divide up the complete hash range into the relevant
sections.
3) Create cores and assign them to each shard, etc.

Prasi, you are doing step 1 and then step 3, but because you never use
Collections API, you are never doing step 2.  Hence Solr has no idea how
many shards you have in your collection, so it assumes 1 when you create
your first core.  Hence everything else after this is just a replica of
that core.

ZkCli can do step 1, and the core API can be used for step 3 (we used it
only because collection API didn't used to support things like dataDir,
with discovery mode this becomes less important, as we can deploy
core.properties files at will) *but* only if you've already defined the
number of shards for your collection either on command line or through use
of collectionAPI.

But (and this is the important bit), the way to do step 2 properly is via
Collections API.  It is also possible to start a solr instance and supply
numShards to it via an environment variable (-DnumShards=X) and that seems
to work, but I don't think that is the recommended approach.



On 13 August 2013 13:05, Erick Erickson <erickerick...@gmail.com> wrote:

> Again, why are you using ...admin/cores rather than admin/collections?
>
> See:
>
> http://wiki.apache.org/solr/SolrCloud#Managing_collections_via_the_Collections_API
>
> Best
> Erick
>
>
> On Tue, Aug 13, 2013 at 5:00 AM, Prasi S <prasi1...@gmail.com> wrote:
>
> > I create a collection prior to tomcat startup.
> >
> > -->java -classpath .;zoo-lib/* org.apache.solr.cloud.ZkCLI -cmd upconfig
> > -zkhost localhost:2181 -confdir solr-conf -confname solrconf1
> >
> > -->java -classpath .;zoo-lib/* org.apache.solr.cloud.ZkCLI -cmd
> linkconfig
> > -zkhost 127.0.0.1:2181 -collection firstcollection -confname solrconf1
> > -solrhome ../solr_instances/solr
> >
> > 1. Start Zookeeper server
> > 2. Link the configuaration to the collection
> > 3. Check those in ZooClient
> > 4. Start tomcats
> > 5. Create cores and assign to collections.
> >
> >
> >
> http://localhost:8080/solr/admin/cores?action=CREATE&name=mycore_sh1&collection=firstcollection&shard=shard1
> >
> > Are these ok or am I making a mistake?
> >
> >
> > On Mon, Aug 12, 2013 at 6:49 PM, Erick Erickson <erickerick...@gmail.com
> > >wrote:
> >
> > > Why are you using the core creation commands rather than the
> > > collection commands? The latter are intended for SolrCloud...
> > >
> > > Best
> > > Erick
> > >
> > >
> > > On Mon, Aug 12, 2013 at 4:51 AM, Prasi S <prasi1...@gmail.com> wrote:
> > >
> > > > Hi,
> > > > I have setup solrcloud in solr 4.4, with 2 solr's in 2 tomcat servers
> > and
> > > > Zookeeper.
> > > >
> > > > I setup Zookeeper with a collection "firstcollection" and then i give
> > the
> > > > belwo command
> > > >
> > > >
> > > >
> > >
> >
> http://localhost:8080/solr/admin/cores?action=CREATE&name=mycore_sh1&collection=firstcollection&shard=shard1
> > > >
> > > > Similarly, i create 4 shards. 2 shard in the first instance and two
> > > shards
> > > > in the second instance.
> > > >
> > > > When i index files to
> > > >
> > >
> >
> http://localhost:8080/solr/firstcollection/dataimport?command=full-import,
> > > > the data always gets indexed to the shard1.
> > > >
> > > > There are no documents in shard2, 3 ,4. I checked this with
> > > >
> > > > http://localhost:8080/solr/firstcollection/select?q=*:*&fl=[shard]
> > > >
> > > > But searching across any of the two gives full results. It this a
> > problem
> > > > with 4.4 version.
> > > >
> > > > Similar scenario , i have tested in solr 4.0 and itr was working
> fine.
> > > >
> > > > Pls help.
> > > >
> > >
> >
>

Reply via email to