Can we used CloudSolrServer for searching data
I am using Solrcloud with zookeeper setup. but when I try to make query using following code snippet I get exception code: CloudSolrServer server = new CloudSolrServer(localhost:2181); server.setDefaultCollection(gettingstarted); server.connect(); SolrQuery query = new SolrQuery(); query.setQuery(q); QueryResponse rsp; rsp = server.query(query); Exception: Exception in thread main org.apache.solr.common.SolrException: Collection not found: gettingstarted at org.apache.solr.client.solrj.impl.CloudSolrServer.getCollectionList(CloudSolrServer.java:679) at org.apache.solr.client.solrj.impl.CloudSolrServer.request(CloudSolrServer.java:562) at org.apache.solr.client.solrj.request.QueryRequest.process(QueryRequest.java:91) at org.apache.solr.client.solrj.SolrServer.query(SolrServer.java:301) at Test.testSelectQueryCloudServer(Test.java:243) at Test.main(Test.java:357) I’ve verified the collection exists on zookeeper using zkCli and I can query using solr admin Sent from Windows Mail
Re: Can we used CloudSolrServer for searching data
Thanks for your reply. I am using Solrcloud with zookeeper setup. And using CloudSolrServer for both indexing and searching. As per my understanding CloudSolrserver by default using LBHttpSolrServer. And CloudSolrServer connect to Zookeeper and passing all the running server node to LBHttpSolrServer. Thanks for you guys once again for your reply. -- View this message in context: http://lucene.472066.n3.nabble.com/Can-we-used-CloudSolrServer-for-searching-data-tp4086766p4089475.html Sent from the Solr - User mailing list archive at Nabble.com.
Re: Can we used CloudSolrServer for searching data
Shalin is right. If you read the documentation for CloudSolrServer you will see that: *SolrJ client class to communicate with SolrCloud. Instances of this class communicate with Zookeeper to discover Solr endpoints for SolrCloud collections, and then use the LBHttpSolrServer to issue requests.* * * It uses *LBHttpSolrServer *for communication and that is what are you looking for. Here is explanation of constructing it: SolrServer lbHttpSolrServer = new LBHttpSolrServer(http://host1:8080/solr/,http://host2:8080/solr,http://host2:8080/solr;); //or if you wish to pass the HttpClient do as follows httpClient httpClient = new HttpClient(); SolrServer lbHttpSolrServer = new LBHttpSolrServer(httpClient,http://host1:8080/solr/,http://host2:8080/solr,http://host2:8080/solr;); Than you can use it as a *SolrServer*. 2013/9/3 Shalin Shekhar Mangar shalinman...@gmail.com CloudSolrServer can only be used if you are actually using SolrCloud (i.e. a ZooKeeper aware setup). If you only have a multi-core setup, then you can use LBHttpSolrServer. See http://wiki.apache.org/solr/LBHttpSolrServer On Tue, Aug 27, 2013 at 2:11 PM, Dharmendra Jaiswal dharmendra.jais...@gmail.com wrote: Hello, I am using multi-core mechnism with Solr4.4.0. And each core is dedicated to a particular client (each core is a collection) Like If we search data from SiteA, it will provide search result from CoreA And if we search data from SiteB, it will provide search result from CoreB and similar case with other client. Right now i am using HttpSolrServer (SolrJ API) for connecting with Solr for search. As per my understanding it will try to connect directly to a particular Solr instance for searching and if that node will be down searching will fail. please let me know if my assumption is wrong. My query is that is it possible to connect with Solr using CloudSolrServer instead of HTTPSolrServer for searching. so that in case one node will be down cloud solr server will pick data from other instance of Solr. Any pointer and link will be helpful. it will be better if some one shared me some example related to connection using ClouSolrServer. Note: I am Using Windows machine for deployment of Solr. And we are indexing data from database using DIH Thanks, Dharmendra jaiswal -- View this message in context: http://lucene.472066.n3.nabble.com/Can-we-used-CloudSolrServer-for-searching-data-tp4086766.html Sent from the Solr - User mailing list archive at Nabble.com. -- Regards, Shalin Shekhar Mangar.
Re: Can we used CloudSolrServer for searching data
CloudSolrServer can only be used if you are actually using SolrCloud (i.e. a ZooKeeper aware setup). If you only have a multi-core setup, then you can use LBHttpSolrServer. See http://wiki.apache.org/solr/LBHttpSolrServer On Tue, Aug 27, 2013 at 2:11 PM, Dharmendra Jaiswal dharmendra.jais...@gmail.com wrote: Hello, I am using multi-core mechnism with Solr4.4.0. And each core is dedicated to a particular client (each core is a collection) Like If we search data from SiteA, it will provide search result from CoreA And if we search data from SiteB, it will provide search result from CoreB and similar case with other client. Right now i am using HttpSolrServer (SolrJ API) for connecting with Solr for search. As per my understanding it will try to connect directly to a particular Solr instance for searching and if that node will be down searching will fail. please let me know if my assumption is wrong. My query is that is it possible to connect with Solr using CloudSolrServer instead of HTTPSolrServer for searching. so that in case one node will be down cloud solr server will pick data from other instance of Solr. Any pointer and link will be helpful. it will be better if some one shared me some example related to connection using ClouSolrServer. Note: I am Using Windows machine for deployment of Solr. And we are indexing data from database using DIH Thanks, Dharmendra jaiswal -- View this message in context: http://lucene.472066.n3.nabble.com/Can-we-used-CloudSolrServer-for-searching-data-tp4086766.html Sent from the Solr - User mailing list archive at Nabble.com. -- Regards, Shalin Shekhar Mangar.
Can we used CloudSolrServer for searching data
Hello, I am using multi-core mechnism with Solr4.4.0. And each core is dedicated to a particular client (each core is a collection) Like If we search data from SiteA, it will provide search result from CoreA And if we search data from SiteB, it will provide search result from CoreB and similar case with other client. Right now i am using HttpSolrServer (SolrJ API) for connecting with Solr for search. As per my understanding it will try to connect directly to a particular Solr instance for searching and if that node will be down searching will fail. please let me know if my assumption is wrong. My query is that is it possible to connect with Solr using CloudSolrServer instead of HTTPSolrServer for searching. so that in case one node will be down cloud solr server will pick data from other instance of Solr. Any pointer and link will be helpful. it will be better if some one shared me some example related to connection using ClouSolrServer. Note: I am Using Windows machine for deployment of Solr. And we are indexing data from database using DIH Thanks, Dharmendra jaiswal -- View this message in context: http://lucene.472066.n3.nabble.com/Can-we-used-CloudSolrServer-for-searching-data-tp4086766.html Sent from the Solr - User mailing list archive at Nabble.com.