apache phoenix客户端无法通过zookeper与远程hbase服务器连接

hgqdbh6s  于 2021-06-09  发布在  Hbase
关注(0)|答案(1)|浏览(501)

我在从任何远程计算机将apache phoenix jdbc客户机(我使用sqlline.py进行测试)连接到hbase时遇到问题。
我的测试方法如下:
我使用ssh连接到另一台运行linux的机器,然后尝试连接到zookeeper仲裁(目前只有一台机器:christianwith kp):

hadoopuser@mike-iMac ~/phoenix-4.4.0-HBase-1.0-bin/bin $./sqlline.py christianwirth-KP
    Setting property: [isolation, TRANSACTION_READ_COMMITTED]
    issuing: !connect jdbc:phoenix:christianwirth-KP none none org.apache.phoenix.jdbc.PhoenixDriver
    Connecting to jdbc:phoenix:christianwirth-KP
    SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
    SLF4J: Defaulting to no-operation (NOP) logger implementation
    SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
    15/08/06 14:11:36 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable

在尝试连接命令行之后,什么也没做,几分钟后我收到了很多java错误消息。
这是来自日志文件zookeeper.out的,看起来zookeeper正在接受来自运行sqlline.py的远程客户端的连接,因为ip地址与我尝试连接的远程计算机匹配。

2015-08-06 14:10:37,720 [myid:] - INFO  [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxnFactory@197] - Accepted socket connection from /192.168.59.148:39731
    2015-08-06 14:10:37,721 [myid:] - INFO  [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:ZooKeeperServer@868] - Client attempting to establish new session at /192.168.59.148:39731
    2015-08-06 14:10:37,726 [myid:] - INFO  [SyncThread:0:ZooKeeperServer@617] - Established session 0x14f02da342b001b with negotiated timeout 40000 for client /192.168.59.148:39731
    2015-08-06 14:10:37,785 [myid:] - INFO  [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxnFactory@197] - Accepted socket connection from /192.168.59.148:39732
    2015-08-06 14:10:37,786 [myid:] - INFO  [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:ZooKeeperServer@868] - Client attempting to establish new session at /192.168.59.148:39732
    2015-08-06 14:10:37,794 [myid:] - INFO  [SyncThread:0:ZooKeeperServer@617] - Established session 0x14f02da342b001c with negotiated timeout 40000 for client /192.168.59.148:39732
    2015-08-06 14:11:37,045 [myid:] - INFO  [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxnFactory@197] - Accepted socket connection from /192.168.59.148:39736
    2015-08-06 14:11:37,047 [myid:] - INFO  [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:ZooKeeperServer@868] - Client attempting to establish new session at /192.168.59.148:39736
    2015-08-06 14:11:37,052 [myid:] - INFO  [SyncThread:0:ZooKeeperServer@617] - Established session 0x14f02da342b001d with negotiated timeout 40000 for client /192.168.59.148:39736
    2015-08-06 14:11:37,702 [myid:] - INFO  [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxnFactory@197] - Accepted socket connection from /192.168.59.148:39737
    2015-08-06 14:11:37,702 [myid:] - INFO  [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:ZooKeeperServer@868] - Client attempting to establish new session at /192.168.59.148:39737
    2015-08-06 14:11:37,707 [myid:] - INFO  [SyncThread:0:ZooKeeperServer@617] - Established session 0x14f02da342b001e with negotiated timeout 40000 for client /192.168.59.148:39737

如果我尝试连接到我的本地机器,一切正常。我确定Phoenix城的两个版本是一样的。。。
现在让我们开始我的设置,我使用以下版本:
hadoop:2.5.2版
Zookeeper:3.4.6
hbase:1.0.1.1版
Phoenix城:4.4.0
我单独运行zookeeper,而不是通过hbase。
这是my hbase-site.xml:

<configuration>
  <property>
    <name>hbase.cluster.distributed</name>
    <value>true</value>
  </property>
  <property>
    <name>hbase.rootdir</name>
    <value>hdfs://localhost:9000/hbase</value>
  </property>
  <property>
    <name>zookeeper.znode.parent</name>
    <value>/hbase</value>
  </property>
  <property>
    <name>hbase.zookeeper.quorum</name>
    <value>christianwirth-kp</value>
  </property>
  <property>
    <name>hbase.zookeeper.property.clientPort</name>
    <value>2181</value>
    <description>Property from ZooKeeper's config zoo.cfg.
      The port at which the clients will connect.
    </description>
  </property>
  <property>
    <name>hbase.regionserver.wal.codec</name>
    <value>org.apache.hadoop.hbase.regionserver.wal.IndexedWALEditCodec</value>
  </property>
  <property>
    <name>phoenix.query.timeoutMs</name>
    <value>1800000</value>
  </property>
  <property>
    <name>phoenix.query.threadPoolSize</name>
    <value>8</value>
  </property>
  <property>
    <name>hbase.rpc.timeout</name>
    <value>1800000</value>
  </property>
  <property>
    <name>hbase.client.scanner.timeout.period</name>
    <value>600000</value>
    <source>hbase-default.xml</source>
  </property>
</configuration>

这是我的etc/主机:

192.168.60.43     hbase christianwirth-KP localhost

# The following lines are desirable for IPv6 capable hosts

::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

这是我在运行jps时的输出:

6555 HMaster
6435 QuorumPeerMain
13614 Jps
6300 SecondaryNameNode
6658 HRegionServer
5746 NameNode
6002 DataNode

---开始编辑:10.08.15
我刚刚意识到的另一件事是,如果我把

christianwirth-KP

到文件hbase/conf/regionservers,但如果

localhost

在那里。。。
---结束编辑:10.08.15
我已经检查了很多其他与我的问题有关的主题,但似乎没有解决办法。如果有人知道这里出了什么问题,我会非常感谢你的帮助。
最好的,
克里斯

qnzebej0

qnzebej01#

经过几个小时的沮丧和无奈,我找到了解决办法:你必须使用机器的ip地址,而不是名称。
我编辑了hbase-site.xml,如下所示:

<property>
  <name>hbase.zookeeper.quorum</name>
  <value>192.168.59.81</value>
</property>

我的regionservers-文件如下所示:

localhost

myzoo.cfg包含:


# Define Quorum-Servers

  server.1=192.168.59.81:2888:3888

希望这能帮助其他有同样问题的人远程连接到一个伪分布式hbase集群。

相关问题