You can check the source code of LBHttpSolrServer and try to implement something like that as your own.
2013/7/10 Floyd Wu <floyd...@gmail.com> > Hi anshum > Thanks for your response. > My application is developed using C#, so I can't use CloudSolrServer with > SolrJ. > > My problem is there is a setting in my application > > SolrUrl = http://xxx.xxx.xxx.xxx:8983/solr/collection1 > > When this Solr instance shutdown or crash, I have to change this setting. > I've read source code of CloudSolrServer.java in SolrJ just few minutes > ago. > > It seems to that CloudSolrServer first read cluster state from zk ( or some > live node) > to retrieve info and then use this info to decide which node to send > request. > > Maybe I have to modify my application to mimic CloudSolrServer impl. > > Any idea? > > Floyd > > > > > 2013/7/10 Anshum Gupta <ans...@anshumgupta.net> > > > You don't really need to direct any query specifically to a leader. It > will > > automatically be routed to the right leader. > > You may put a load balancer on top to just fix the problem with querying > a > > node that has gone away. > > > > Also, ZK aware SolrJ Java client that load-balances across all nodes in > > cluster. > > > > > > On Wed, Jul 10, 2013 at 2:52 PM, Floyd Wu <floyd...@gmail.com> wrote: > > > > > Hi there, > > > > > > I've built a SolrCloud cluster from example, but I have some question. > > > When I send query to one leader (say > > > http://xxx.xxx.xxx.xxx:8983/solr/collection1) and no problem > everything > > > will be fine. > > > > > > When I shutdown that leader, the other replica( > > > http://xxx.xxx.xxx.xxx:9983/solr/collection1) in the some shard will > be > > > new > > > leader. The problem is: > > > > > > The application doesn't know new leader's location and still send > request > > > to http://xxx.xxx.xxx.xxx:8983/solr/collection1 and of course no > > response. > > > > > > How can I know new leader in my application? > > > Are there any mechanism that application can send request to one fixed > > > endpoint no matter who is leader? > > > > > > For example, application just send to > > > http://xxx.xxx.xxx.xxx:8983/solr/collection1 > > > even the real leader run on > http://xxx.xxx.xxx.xxx:9983/solr/collection1 > > > > > > Please help on this or give me some key infomation to google it. > > > > > > Many thanks. > > > > > > Floyd > > > > > > > > > > > -- > > > > Anshum Gupta > > http://www.anshumgupta.net > > >