You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Saumitra Srivastav <sa...@gmail.com> on 2014/01/07 22:41:16 UTC

Perl Client for SolrCloud

Is there any perl client for SolrCloud. There are some Solr clients in perl
but they are for single node Solr.

I couldn't find anyone which can connect to SolrCloud similar to SolrJ's
CloudSolrServer.

Regards,
Saumtra




--
View this message in context: http://lucene.472066.n3.nabble.com/Perl-Client-for-SolrCloud-tp4110077.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Perl Client for SolrCloud

Posted by Chris Hostetter <ho...@fucit.org>.
: A quick question though: how would I write the shard logic to behave similar
: to Java's Zookeeper-aware client? I'm able to get the hash/hex needed for each
: shard from clusterstate.json, but how do I know which field to hash on?

The logic you're asking about is encapsulated in the DocRouter (which can 
be customized per collection).  I'm not sure how the CloudSolrServer SolrJ 
client current deals with knowing which DocRouter to use, but for a 
non-Java langauge that can't directly load the same classes a great first 
step would be...

 * be conigurable solely with a list of ZK addresses
 * connect to ZK and per collection be continuously aware of:
   - the list of all live nodes as they go up/down
   - the list of leaders as shard elections happen
 * for queries, route to a random live node
 * for updates, route to any live leader

the most important part being the first 2 bullets. the last bullet being 
an optimization over just sending to a random node because you increase 
the odds of hitting the correct leader for the doc in question regardless 
of which DocRouter is in use. 


-Hoss
http://www.lucidworks.com/

Re: Perl Client for SolrCloud

Posted by Tim Vaillancourt <ti...@elementspace.com>.
I'm pretty interested in taking a stab at a Perl CPAN for SolrCloud that 
is Zookeeper-aware; it's the least I can do for Solr as a non-Java 
developer. :)

A quick question though: how would I write the shard logic to behave 
similar to Java's Zookeeper-aware client? I'm able to get the hash/hex 
needed for each shard from clusterstate.json, but how do I know which 
field to hash on?

I'm guessing I also need to read the collection's schema.xml from 
Zookeeper to get uniqueKey, and then use that for sharding, or does the 
Java client take the sharding field as input? Looking for ideas here.

Thanks!

Tim

On 08/01/14 09:35 AM, Chris Hostetter wrote:
> :>  I couldn't find anyone which can connect to SolrCloud similar to SolrJ's
> :>  CloudSolrServer.
> :
> : Since I have a load balancer in front of 8 nodes, WebService::Solr[1] still
> : works fine.
>
> Right -- just because SolrJ is ZooKeeper aware doesn't mean you can *only*
> talk to SolrCloud with SolrJ -- you can still use any HTTP client of your
> choice to connect to your Solr nodes in a round robin fashion (or via a
> load blancer) if you wish -- just like with a non SolrCloud deployment
> using something like master/slave.
>
> What you might want to consider, is taking a look at something like
> Net::ZooKeeper to have a ZK aware perl client layer that could wrap
> WebService::Solr.
>
>
> -Hoss
> http://www.lucidworks.com/

Re: Perl Client for SolrCloud

Posted by Chris Hostetter <ho...@fucit.org>.
: > I couldn't find anyone which can connect to SolrCloud similar to SolrJ's
: > CloudSolrServer.
: 
: Since I have a load balancer in front of 8 nodes, WebService::Solr[1] still
: works fine.

Right -- just because SolrJ is ZooKeeper aware doesn't mean you can *only* 
talk to SolrCloud with SolrJ -- you can still use any HTTP client of your 
choice to connect to your Solr nodes in a round robin fashion (or via a 
load blancer) if you wish -- just like with a non SolrCloud deployment 
using something like master/slave.

What you might want to consider, is taking a look at something like 
Net::ZooKeeper to have a ZK aware perl client layer that could wrap 
WebService::Solr.


-Hoss
http://www.lucidworks.com/

Re: Perl Client for SolrCloud

Posted by David Santamauro <da...@gmail.com>.
On 01/07/2014 04:41 PM, Saumitra Srivastav wrote:
> Is there any perl client for SolrCloud. There are some Solr clients in perl
> but they are for single node Solr.
>
> I couldn't find anyone which can connect to SolrCloud similar to SolrJ's
> CloudSolrServer.

Since I have a load balancer in front of 8 nodes, WebService::Solr[1] 
still works fine.

haproxy[2] load balancer is a wonderful tool.

[1] 
http://search.cpan.org/~petdance/WebService-Solr-0.22/lib/WebService/Solr.pm
[2] http://haproxy.1wt.eu/