You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@solr.apache.org by Reej M <re...@gmail.com> on 2021/07/08 11:00:45 UTC
Could not load collection from ZK (worked in solr4, failing in solr8)
- Help Needed
Hi All,
We are upgrading from solr 4 to solr 8. Updated the solr server to solr8.8.2, solrj8.8.2.
We are trying to resume the code and in one place where we are trying to get a collection from clusterstate. Code used is as below
Clusterstate clusterState = null;
For(SearchSolrZookeeper zk:livezks){
SolrZkClient zkClient = null;
ZKStateReader stateReader = null;
Try{
Zkclient = new SolrZkClient(zk.getUrl(), 3000);
stateReader = new ZKStateReader(Zkclient);
stateReader.createClusterStateWatchersAndUpdate();
clusterState = stateReader.getClusterState();
Connected = true;
Exception = null;
break;
}
Catch(){
}
Finally{
State reader.close();
Zkclient.close();
}
If(clusterstate!=null){
Doccollection dc = clusterstate.getCollection(“INVOICE”);
//here dc is null
}
}
Tried using getcollectionornull - returns null
Getcollectionornull(collection name, true) — returns null
When I debug I can see clusterstate has below values in it
Znodeversion:0
Live node:[192.123.33.44:3883_Solr, 192.123.33.44:9883_Solr,192.123.33.45:3883_Solr,192.123.33.45:3883_Solr]
Collections:{ORDER=LazyCollectionRef(ORDER), INVOICE= LazyCollectionRef(INVOICE), PAYMENT= LazyCollectionRef(PAYMENT),etc..}
From the document collection we get the slices and iterate each replica to show the cores in a admin page. But this page worked fine with the code in solr4, now with solr8 it throws error. Kindly help.
Regards
Reej
Re: Could not load collection from ZK (worked in solr4, failing in
solr8) - Help Needed
Posted by Reej Nayagam <re...@gmail.com>.
On Thu, 8 Jul 2021 at 8:10 PM, sachin gk <gk...@gmail.com> wrote:
> Have you upgraded the zookeeper too ? Sole 8.8.2 is compatible with
> zookeeper 3.5.5
>
zk version is 3.6.3
>
> On Thu, Jul 8, 2021, 17:35 Yuval Paz <yu...@mail.huji.ac.il> wrote:
>
> > What error do you see?
> >
> > Also, what are you trying to do? If you are trying to get the cluster's
> > state from an outside service, and not in a Solr plugin, maybe you should
> > use CloudSolrClient instead:
> >
> > ```
> > var client = new CloudSolrClient
> > .builder(Arrays.asList("zkHost1:port1,zkHost2:port2,..."),
> > Optional.empty()).build();
> > ```
> > And then use either the `ClusterStateProvider` from
> > `client.getClusterStateProvider()` or use the
> > `CollectionAdminRequest.clusterStatus` request.
Thank you I tried with cloudsolrclient and it worked instead of
SolrZkClient. When I try to pass the zhkosts it throws host://2181 down? So
I replaced it with the cluster URL and it worked Thanks you.
>
> >
> > On Thu, Jul 8, 2021, 2:01 PM Reej M <re...@gmail.com> wrote:
> >
> > > Hi All,
> > >
> > > We are upgrading from solr 4 to solr 8. Updated the solr server to
> > > solr8.8.2, solrj8.8.2.
> > > We are trying to resume the code and in one place where we are trying
> to
> > > get a collection from clusterstate. Code used is as below
> > >
> > > Clusterstate clusterState = null;
> > > For(SearchSolrZookeeper zk:livezks){
> > > SolrZkClient zkClient = null;
> > > ZKStateReader stateReader = null;
> > > Try{
> > > Zkclient = new SolrZkClient(zk.getUrl(), 3000);
> > > stateReader = new ZKStateReader(Zkclient);
> > > stateReader.createClusterStateWatchersAndUpdate();
> > > clusterState = stateReader.getClusterState();
> > > Connected = true;
> > > Exception = null;
> > > break;
> > > }
> > > Catch(){
> > > }
> > > Finally{
> > > State reader.close();
> > > Zkclient.close();
> > > }
> > >
> > > If(clusterstate!=null){
> > > Doccollection dc = clusterstate.getCollection(“INVOICE”);
> > > //here dc is null
> > > }
> > > }
> > >
> > >
> > > Tried using getcollectionornull - returns null
> > > Getcollectionornull(collection name, true) — returns null
> > >
> > > When I debug I can see clusterstate has below values in it
> > >
> > > Znodeversion:0
> > > Live node:[192.123.33.44:3883_Solr, 192.123.33.44:9883
> > > _Solr,192.123.33.45:3883_Solr,192.123.33.45:3883_Solr]
> > > Collections:{ORDER=LazyCollectionRef(ORDER), INVOICE=
> > > LazyCollectionRef(INVOICE), PAYMENT= LazyCollectionRef(PAYMENT),etc..}
> > >
> > > From the document collection we get the slices and iterate each replica
> > to
> > > show the cores in a admin page. But this page worked fine with the code
> > in
> > > solr4, now with solr8 it throws error. Kindly help.
> > >
> > > Regards
> > > Reej
> >
>
--
*Thanks,*
*Reej*
Re: Could not load collection from ZK (worked in solr4, failing in
solr8) - Help Needed
Posted by sachin gk <gk...@gmail.com>.
Have you upgraded the zookeeper too ? Sole 8.8.2 is compatible with
zookeeper 3.5.5
On Thu, Jul 8, 2021, 17:35 Yuval Paz <yu...@mail.huji.ac.il> wrote:
> What error do you see?
>
> Also, what are you trying to do? If you are trying to get the cluster's
> state from an outside service, and not in a Solr plugin, maybe you should
> use CloudSolrClient instead:
>
> ```
> var client = new CloudSolrClient
> .builder(Arrays.asList("zkHost1:port1,zkHost2:port2,..."),
> Optional.empty()).build();
> ```
> And then use either the `ClusterStateProvider` from
> `client.getClusterStateProvider()` or use the
> `CollectionAdminRequest.clusterStatus` request.
>
> On Thu, Jul 8, 2021, 2:01 PM Reej M <re...@gmail.com> wrote:
>
> > Hi All,
> >
> > We are upgrading from solr 4 to solr 8. Updated the solr server to
> > solr8.8.2, solrj8.8.2.
> > We are trying to resume the code and in one place where we are trying to
> > get a collection from clusterstate. Code used is as below
> >
> > Clusterstate clusterState = null;
> > For(SearchSolrZookeeper zk:livezks){
> > SolrZkClient zkClient = null;
> > ZKStateReader stateReader = null;
> > Try{
> > Zkclient = new SolrZkClient(zk.getUrl(), 3000);
> > stateReader = new ZKStateReader(Zkclient);
> > stateReader.createClusterStateWatchersAndUpdate();
> > clusterState = stateReader.getClusterState();
> > Connected = true;
> > Exception = null;
> > break;
> > }
> > Catch(){
> > }
> > Finally{
> > State reader.close();
> > Zkclient.close();
> > }
> >
> > If(clusterstate!=null){
> > Doccollection dc = clusterstate.getCollection(“INVOICE”);
> > //here dc is null
> > }
> > }
> >
> >
> > Tried using getcollectionornull - returns null
> > Getcollectionornull(collection name, true) — returns null
> >
> > When I debug I can see clusterstate has below values in it
> >
> > Znodeversion:0
> > Live node:[192.123.33.44:3883_Solr, 192.123.33.44:9883
> > _Solr,192.123.33.45:3883_Solr,192.123.33.45:3883_Solr]
> > Collections:{ORDER=LazyCollectionRef(ORDER), INVOICE=
> > LazyCollectionRef(INVOICE), PAYMENT= LazyCollectionRef(PAYMENT),etc..}
> >
> > From the document collection we get the slices and iterate each replica
> to
> > show the cores in a admin page. But this page worked fine with the code
> in
> > solr4, now with solr8 it throws error. Kindly help.
> >
> > Regards
> > Reej
>
Re: Could not load collection from ZK (worked in solr4, failing in
solr8) - Help Needed
Posted by Yuval Paz <yu...@mail.huji.ac.il>.
What error do you see?
Also, what are you trying to do? If you are trying to get the cluster's
state from an outside service, and not in a Solr plugin, maybe you should
use CloudSolrClient instead:
```
var client = new CloudSolrClient
.builder(Arrays.asList("zkHost1:port1,zkHost2:port2,..."),
Optional.empty()).build();
```
And then use either the `ClusterStateProvider` from
`client.getClusterStateProvider()` or use the
`CollectionAdminRequest.clusterStatus` request.
On Thu, Jul 8, 2021, 2:01 PM Reej M <re...@gmail.com> wrote:
> Hi All,
>
> We are upgrading from solr 4 to solr 8. Updated the solr server to
> solr8.8.2, solrj8.8.2.
> We are trying to resume the code and in one place where we are trying to
> get a collection from clusterstate. Code used is as below
>
> Clusterstate clusterState = null;
> For(SearchSolrZookeeper zk:livezks){
> SolrZkClient zkClient = null;
> ZKStateReader stateReader = null;
> Try{
> Zkclient = new SolrZkClient(zk.getUrl(), 3000);
> stateReader = new ZKStateReader(Zkclient);
> stateReader.createClusterStateWatchersAndUpdate();
> clusterState = stateReader.getClusterState();
> Connected = true;
> Exception = null;
> break;
> }
> Catch(){
> }
> Finally{
> State reader.close();
> Zkclient.close();
> }
>
> If(clusterstate!=null){
> Doccollection dc = clusterstate.getCollection(“INVOICE”);
> //here dc is null
> }
> }
>
>
> Tried using getcollectionornull - returns null
> Getcollectionornull(collection name, true) — returns null
>
> When I debug I can see clusterstate has below values in it
>
> Znodeversion:0
> Live node:[192.123.33.44:3883_Solr, 192.123.33.44:9883
> _Solr,192.123.33.45:3883_Solr,192.123.33.45:3883_Solr]
> Collections:{ORDER=LazyCollectionRef(ORDER), INVOICE=
> LazyCollectionRef(INVOICE), PAYMENT= LazyCollectionRef(PAYMENT),etc..}
>
> From the document collection we get the slices and iterate each replica to
> show the cores in a admin page. But this page worked fine with the code in
> solr4, now with solr8 it throws error. Kindly help.
>
> Regards
> Reej
Re: Could not load collection from ZK (worked in solr4, failing in
solr8) - Help Needed
Posted by Reej M <re...@gmail.com>.
> On 8 Jul 2021, at 7:00 PM, Reej M <re...@gmail.com> wrote:
>
> Hi All,
>
> We are upgrading from solr 4 to solr 8. Updated the solr server to solr8.8.2, solrj8.8.2.
> We are trying to resume the code and in one place where we are trying to get a collection from clusterstate. Code used is as below
>
> Clusterstate clusterState = null;
> For(SearchSolrZookeeper zk:livezks){
> SolrZkClient zkClient = null;
> ZKStateReader stateReader = null;
> Try{
> Zkclient = new SolrZkClient(zk.getUrl(), 3000);
> stateReader = new ZKStateReader(Zkclient);
> stateReader.createClusterStateWatchersAndUpdate();
> clusterState = stateReader.getClusterState();
> Connected = true;
> Exception = null;
> break;
> }
> Catch(){
> }
> Finally{
> State reader.close();
> Zkclient.close();
> }
>
> If(clusterstate!=null){
> Doccollection dc = clusterstate.getCollection(“INVOICE”);
> //here dc is null
> }
> }
>
>
> Tried using getcollectionornull - returns null
> Getcollectionornull(collection name, true) — returns null
>
> When I debug I can see clusterstate has below values in it
>
Using SOLR8
> Znodeversion:0
> Live node:[192.123.33.44:3883_Solr, 192.123.33.44:9883_Solr,192.123.33.45:3883_Solr,192.123.33.45:3883_Solr]
> Collections:{ORDER=LazyCollectionRef(ORDER), INVOICE= LazyCollectionRef(INVOICE), PAYMENT= LazyCollectionRef(PAYMENT),etc..}
When Debugging with Solr4 clusterstate is as below
> Znodeversion:134
> Live node:[192.123.33.44:3883_Solr, 192.123.33.44:9883_Solr,192.123.33.45:3883_Solr,192.123.33.45:3883_Solr]
> Collections:{ORDER(ORDER/clusterstate.json/134)={
“Replication factor”:”1”,
“Shards”:{“shard1”:{
Range:
“State”:”active”,
“Replicas”:{
“Core_node1”:{
“Core”:ORDER_shard1_replica1
“Base_url:
“Node_name”:”http://xxxx_solr <http://xxxx_solr/>”
“State”:”active”
“Leader”:”true”},
“Core_node2”:{
“Core”:ORDER_shard1_replica1
“Base_url:
“Node_name”:”http://xxxx_solr <http://xxxx_solr/>”
“State”:”active”
“Leader”:”true”}
}
}
>
> From the document collection we get the slices and iterate each replica to show the cores in a admin page. But this page worked fine with the code in solr4, now with solr8 it throws error.
> Kindly help.
>
> Regards
> Reej