Apache Phoenix客户端无法通过Zookeper与远程hbase服务器连接

时间:2015-08-06 12:42:38

标签: hbase apache-zookeeper phoenix sqlline

我在从任何远程计算机上将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

如果我尝试在本地计算机上连接,一切正常。 我确定凤凰的2版本是相同的......

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

  • Hadoop:2.5.2
  • Zookeeper:3.4.6
  • HBase:1.0.1.1
  • 凤凰城:4.4.0

我单独运行我的zookeeper,而不是通过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>

这是我的etc / hosts:

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

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

最佳,

克里斯

1 个答案:

答案 0 :(得分: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集群的问题。