Support Questions

Find answers, ask questions, and share your expertise

Receving Zookeeper Exception when using SolrJ to Query my collection

avatar
Contributor

I received the following exception when trying to query my collection:

 

2017-04-11 08:28:36,967 INFO  main.waitForConnected - Waiting for client to connect to ZooKeeper
2017-04-11 08:28:37,004 INFO  main-SendThread(dwh-mst-dev01.stor.nccourts.org:2181).logStartConnect - Opening socket connection to server dwh-mst-dev01.stor.nccourts.org/10.91.62.104:2181. Will not attempt to authenticate using SASL (unknown error)
2017-04-11 08:28:37,031 INFO  main-SendThread(dwh-mst-dev01.stor.nccourts.org:2181).primeConnection - Socket connection established to dwh-mst-dev01.stor.nccourts.org/10.91.62.104:2181, initiating session
2017-04-11 08:28:37,035 DEBUG main-SendThread(dwh-mst-dev01.stor.nccourts.org:2181).primeConnection - Session establishment request sent on dwh-mst-dev01.stor.nccourts.org/10.91.62.104:2181
2017-04-11 08:28:37,074 INFO  main-SendThread(dwh-mst-dev01.stor.nccourts.org:2181).onConnected - Session establishment complete on server dwh-mst-dev01.stor.nccourts.org/10.91.62.104:2181, sessionid = 0x15ad7740272589b, negotiated timeout = 10000
2017-04-11 08:28:37,091 INFO  main-EventThread.process - Watcher org.apache.solr.common.cloud.ConnectionManager@18ef96 name:ZooKeeperConnection Watcher:dwh-mst-dev01.stor.nccourts.org:2181/solr,dwh-mst-dev02.stor.nccourts.org:2181/solr,dwh-mst-dev03.stor.nccourts.org:2181/solr got event WatchedEvent state:SyncConnected type:None path:null path:null type:None
2017-04-11 08:28:37,093 INFO  main.waitForConnected - Client is connected to ZooKeeper
2017-04-11 08:28:37,094 INFO  main.createZkACLProvider - Using default ZkACLProvider
2017-04-11 08:28:37,132 DEBUG main-SendThread(dwh-mst-dev01.stor.nccourts.org:2181).readResponse - Reading reply sessionid:0x15ad7740272589b, packet:: clientPath:null serverPath:null finished:false header:: 1,3  replyHeader:: 1,55835836011,-101  request:: '/solr%2Cdwh-mst-dev02.stor.nccourts.org:2181/solr%2Cdwh-mst-dev03.stor.nccourts.org:2181/solr/clusterstate.json,F  response::  
2017-04-11 08:28:37,136 INFO  main.makePath - makePath: /clusterstate.json
2017-04-11 08:28:37,162 DEBUG main-SendThread(dwh-mst-dev01.stor.nccourts.org:2181).readResponse - Reading reply sessionid:0x15ad7740272589b, packet:: clientPath:null serverPath:null finished:false header:: 2,3  replyHeader:: 2,55835836011,-101  request:: '/solr%2Cdwh-mst-dev02.stor.nccourts.org:2181/solr%2Cdwh-mst-dev03.stor.nccourts.org:2181/solr/clusterstate.json,F  response::  
2017-04-11 08:28:37,199 DEBUG main-SendThread(dwh-mst-dev01.stor.nccourts.org:2181).readResponse - Reading reply sessionid:0x15ad7740272589b, packet:: clientPath:null serverPath:null finished:false header:: 3,1  replyHeader:: 3,55835836012,-101  request:: '/solr%2Cdwh-mst-dev02.stor.nccourts.org:2181/solr%2Cdwh-mst-dev03.stor.nccourts.org:2181/solr/clusterstate.json,,v{s{31,s{'world,'anyone}}},0  response::  
2017-04-11 08:28:37,209 DEBUG main.close - Closing session: 0x15ad7740272589b
2017-04-11 08:28:37,210 DEBUG main.close - Closing client for session: 0x15ad7740272589b
2017-04-11 08:28:37,238 DEBUG main-SendThread(dwh-mst-dev01.stor.nccourts.org:2181).readResponse - Reading reply sessionid:0x15ad7740272589b, packet:: clientPath:null serverPath:null finished:false header:: 4,-11  replyHeader:: 4,55835836013,0  request:: null response:: null
2017-04-11 08:28:37,239 DEBUG main-SendThread(dwh-mst-dev01.stor.nccourts.org:2181).run - An exception was thrown while closing send thread for session 0x15ad7740272589b : Unable to read additional data from server sessionid 0x15ad7740272589b, likely server has closed socket
2017-04-11 08:28:37,240 DEBUG main.disconnect - Disconnecting client for session: 0x15ad7740272589b
2017-04-11 08:28:37,241 INFO  main.close - Session: 0x15ad7740272589b closed
2017-04-11 08:28:37,241 INFO  main-EventThread.run - EventThread shut down
Exception in thread "main" org.apache.solr.common.cloud.ZooKeeperException:
    at org.apache.solr.client.solrj.impl.CloudSolrServer.connect(CloudSolrServer.java:270)
    at org.apache.solr.client.solrj.impl.CloudSolrServer.request(CloudSolrServer.java:548)
    at org.apache.solr.client.solrj.request.QueryRequest.process(QueryRequest.java:91)
    at org.apache.solr.client.solrj.SolrServer.query(SolrServer.java:301)
    at org.nccourts.hadoop.solrj.SolrjQuery.getResults(SolrjQuery.java:34)
    at org.nccourts.hadoop.solrj.SolrjQuery.main(SolrjQuery.java:22)
Caused by: org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /clusterstate.json
    at org.apache.zookeeper.KeeperException.create(KeeperException.java:111)
    at org.apache.zookeeper.KeeperException.create(KeeperException.java:51)
    at org.apache.zookeeper.ZooKeeper.create(ZooKeeper.java:783)
    at org.apache.solr.common.cloud.SolrZkClient$10.execute(SolrZkClient.java:507)
    at org.apache.solr.common.cloud.ZkCmdExecutor.retryOperation(ZkCmdExecutor.java:61)
    at org.apache.solr.common.cloud.SolrZkClient.makePath(SolrZkClient.java:504)
    at org.apache.solr.common.cloud.SolrZkClient.makePath(SolrZkClient.java:461)
    at org.apache.solr.common.cloud.SolrZkClient.makePath(SolrZkClient.java:448)
    at org.apache.solr.common.cloud.SolrZkClient.makePath(SolrZkClient.java:435)
    at org.apache.solr.common.cloud.ZkCmdExecutor.ensureExists(ZkCmdExecutor.java:94)
    at org.apache.solr.common.cloud.ZkCmdExecutor.ensureExists(ZkCmdExecutor.java:84)
    at org.apache.solr.common.cloud.ZkStateReader.createClusterStateWatchersAndUpdate(ZkStateReader.java:295)
    at org.apache.solr.client.solrj.impl.CloudSolrServer.connect(CloudSolrServer.java:261)
    ... 5 more

 

I am using Cloudera CDH 5.10.

 

My program is very simple:

---

public class SolrjQuery {

    public static void main(final String[] args) throws SolrServerException, IOException {

        final String zkHostString = "dwh-mst-dev01.stor.nccourts.org:2181/solr,dwh-mst-dev02.stor.nccourts.org:2181/solr,dwh-mst-dev03.stor.nccourts.org:2181/solr";

        final CloudSolrServer solr = new CloudSolrServer(zkHostString);
        solr.setDefaultCollection("party_name");

        final SolrDocumentList docs = SolrjQuery.getResults(solr);
        for (final SolrDocument doc : docs) {
            System.out.println(doc);
        }
    }

    static SolrDocumentList getResults(final CloudSolrServer server) {
        final SolrQuery query = new SolrQuery();
        query.setQuery("*:*");

        QueryResponse rsp = null;
        try {
            rsp = server.query(query);
        } catch (final SolrServerException e) {
            e.printStackTrace();
            return null;
        }
        final SolrDocumentList docs = rsp.getResults();
        return docs;
    }
}

---

1 ACCEPTED SOLUTION

avatar
Super Collaborator

Severals idea :

- Not sure it is mandatory to specify the path of the root znode where solr is installed on each host. I think you should supply it only at the end of the quorum - "host1:port,host2:port,host3:port/solr". (I think this is your issue)

- Does Solr is installed inside the /solr znode ?

- What is the size of the current "clusterstate.json" znode ? (does it exists ?)

- Does your current "clusterstate.json" content is valid ?

- Does zookeeper is hosted on the 3 nodes you have specified ? (can you ping these hosts ?)

 

Good luck !

 

 

View solution in original post

2 REPLIES 2

avatar
Super Collaborator

Severals idea :

- Not sure it is mandatory to specify the path of the root znode where solr is installed on each host. I think you should supply it only at the end of the quorum - "host1:port,host2:port,host3:port/solr". (I think this is your issue)

- Does Solr is installed inside the /solr znode ?

- What is the size of the current "clusterstate.json" znode ? (does it exists ?)

- Does your current "clusterstate.json" content is valid ?

- Does zookeeper is hosted on the 3 nodes you have specified ? (can you ping these hosts ?)

 

Good luck !

 

 

avatar
Contributor
By fixing the Zookeeper string as suggested: "host1:port,host2:port,host3:port/solr",
the problem was fixed. Thanks.