[英]Java client fails to connect to Zookeeper and HBase
I wrote a simple HBase client program to perform CRUD operations in my HBase cluster (1 Master and 3 Region Server). 我写了一个简单的HBase客户端程序来在我的HBase集群中执行CRUD操作(1个Master和3 Region Server)。 The Zookeeper instance is only running in the master server and the quorum includes all the 4 servers.
Zookeeper实例仅在主服务器中运行,仲裁包括所有4个服务器。 The cluster is running fine and can perform read/write using YCSB client (means there are nothing wrong in the server/zookeeper side).
集群运行正常,可以使用YCSB客户端执行读/写(意味着服务器/ zookeeper端没有任何错误)。
Now in the eclipse classpath I have added all the HBase libs and hbase-0.94.7.jar (which contains the hbase-default.xml file). 现在在eclipse类路径中,我添加了所有HBase库和hbase-0.94.7.jar(包含hbase-default.xml文件)。 I have also added the original hbase-site.xml file from the cluster in the project.
我还在项目的集群中添加了原始的hbase-site.xml文件。
Initially, I ran the client code using the unmodified hbase-default.xml and what I've found that the client is trying to communicate with the localhost for zookeeper instance. 最初,我使用未修改的hbase-default.xml运行客户端代码,并且我发现客户端正在尝试与zoohost实例进行通信。 And thus ignoring the hbase-site.xml.
从而忽略了hbase-site.xml。
Then I've modified the 3 parameters which holds the public IP address of the Master/Zookpeer server and tried again. 然后我修改了3个参数,这些参数保存了Master / Zookpeer服务器的公共IP地址并再次尝试。 This time I am getting the below error where the client is continuously trying to connect with the Zookeeper and its other quorum members.
这次我得到以下错误,客户端不断尝试与Zookeeper及其他仲裁成员连接。
I have all the 4 servers in the Zookeeper quorum and lets say their IP addresses are: 我拥有Zookeeper仲裁中的所有4台服务器,并说它们的IP地址是:
WWWW // HBase master and Zookeeper Server WWWW // HBase master和Zookeeper Server
XXXX // HBase RS and Zookeeper Quorum Member XXXX // HBase RS和Zookeeper Quorum会员
YYYY // HBase RS and Zookeeper Quorum Member YYYY // HBase RS和Zookeeper Quorum会员
ZZZZ // HBase RS and Zookeeper Quorum Member ZZZZ // HBase RS和Zookeeper Quorum会员
13/06/19 13:06:23 INFO zookeeper.ZooKeeper: Initiating client connection, connectString=W.W.W.W:2181,X.X.X.X:2181,Y.Y.Y.Y:2181,Z.Z.Z.Z:2181 sessionTimeout=180000 watcher=hconnection 13/06/19 13:06:23 INFO zookeeper.RecoverableZooKeeper: The identifier of this process is 5828@Kamal-VAIO 13/06/19 13:06:24 INFO zookeeper.ClientCnxn: Opening socket connection to server W.W.W.W:2181. Will not attempt to authenticate using SASL (unknown error) 13/06/19 13:06:25 WARN zookeeper.ClientCnxn: Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect java.net.ConnectException: Connection refused: no further information
13/06/19 13:06:25 WARN zookeeper.RecoverableZooKeeper: Possibly transient ZooKeeper exception: org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss for /hbase/hbaseid 13/06/19 13:06:25 INFO util.RetryCounter: Sleeping 2000ms before retry #1... 13/06/19 13:06:25 INFO zookeeper.ClientCnxn: Opening socket connection to server X.X.X.X:2181. Will not attempt to authenticate using SASL (unknown error) 13/06/19 13:06:26 WARN zookeeper.ClientCnxn: Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect java.net.ConnectException: Connection refused: no further information
... and so on ... 等等
The Problem has been solved. 问题已经解决了。
NOTE: Step 10 is must, otherwise the client will get the hostnames from the Zookeeper instance and will not able to resolve them. 注意:必须执行步骤10,否则客户端将从Zookeeper实例获取主机名,并且无法解析它们。
Many thanks everyone. 非常感谢大家。
Actually the problem is with kafka-client. 实际上问题出在kafka-client上。 So in this case, you have to use explicitly kafka-client dependency version 1.0.2 .
因此,在这种情况下,您必须明确使用kafka-client依赖版本1.0.2 。 sometimes other kafka-client versions giving problems.
有时其他kafka-client版本会出现问题。 In my case after setting kafka-client version & scope "provided", the error disappeared.
在我设置kafka-client版本和范围“提供”后,错误消失了。
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka-clients</artifactId>
<version>1.0.2</version>
<scope>provided</scope>
</dependency>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.