1

我在从任何远程计算机将 Apache Phoenix JDBC 客户端(我使用 sqlline.py 用于测试目的)连接到我的 Hbase 时遇到问题。

我正在测试的方式如下:

我 ssh 到另一台运行 linux 的机器,然后尝试连接到我的 zookeeper quorum(目前只是一台机器: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

如果我尝试在本地机器上连接一切正常。我确保 2 版本的 phoenix 是相同的......

现在让我们开始我的设置,我使用以下版本:

  • Hadoop:2.5.2
  • 动物园管理员:3.4.6
  • HBase:1.0.1.1
  • 凤凰:4.4.0

我单独运行我的动物园管理员,而不是通过 HBase。

这是我的 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>

这是我的等/主机:

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

我刚刚意识到的另一件事是,如果我只是把我的 regionserver 不会启动

  christianwirth-KP

到文件 HBase/conf/regionservers 但如果我把它启动

  localhost 

在那里...

---结束编辑:10.08.15

我已经检查了很多与我的问题相关的其他主题,但似乎没有解决方案有帮助。如果有人知道这里出了什么问题,我将非常感谢您的帮助。

最好的,

克里斯

4

1 回答 1

5

经过几个小时的挫折和辞职后,我找到了解决方案:您必须使用机器的 IP 地址,而不是名称。

我编辑了我的 hbase-site.xml 如下:

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

我的 regionservers - 文件如下所示:

  localhost

我的 zoo.cfg 包含:

  # Define Quorum-Servers
  server.1=192.168.59.81:2888:3888

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

于 2015-08-10T12:24:31.403 回答