【问题标题】:HBase client for Spark cannot be authenticated in ZooKeeper using SASLSpark 的 HBase 客户端无法在 ZooKeeper 中使用 SASL 进行身份验证
【发布时间】:2017-08-03 06:35:20
【问题描述】:

我正在处理来自 Spark(EMR,在 Yarn 模式下)的 HBase 表。实际上,PySpark - 我认为这并不重要。我从 HBase 集群外部通过单独的 Thrift 服务调用 HBase。

看起来我能够连接到 Thrift 服务器,但 ZooKeeper 有一些问题(因为错误将我指向 ZooKeeper 端口 2181)。

为什么会发生这种情况,我该如何解决?

17/08/02 20:21:31 INFO ZooKeeper: Client environment:java.io.tmpdir=/tmp
17/08/02 20:21:31 INFO ZooKeeper: Client environment:java.compiler=<NA>
17/08/02 20:21:31 INFO ZooKeeper: Client environment:os.name=Linux
17/08/02 20:21:31 INFO ZooKeeper: Client environment:os.arch=amd64
17/08/02 20:21:31 INFO ZooKeeper: Client environment:os.version=4.4.35-33.55.amzn1.x86_64
17/08/02 20:21:31 INFO ZooKeeper: Client environment:user.name=hadoop
17/08/02 20:21:31 INFO ZooKeeper: Client environment:user.home=/home/hadoop
17/08/02 20:21:31 INFO ZooKeeper: Client environment:user.dir=/home/hadoop/data
17/08/02 20:21:31 INFO ZooKeeper: Initiating client connection, connectString=thrift-internal.production.k8s.prod.node.io:2181 sessionTimeout=180000 watcher=org.apache.hadoop.hbase.zookeeper.PendingWatcher@2818bc0e
17/08/02 20:21:31 INFO ClientCnxn: Opening socket connection to server ip-172-23-115-152.us-west-2.compute.internal/172.23.115.152:2181. Will not attempt to authenticate using SASL (unknown error)

【问题讨论】:

    标签: apache-spark pyspark hbase apache-zookeeper thrift


    【解决方案1】:

    作为 HBase 客户端,您必须同时连接:HBase 服务(直接或通过 Thrift)和 ZooKeeper 服务(通常与 HBase Master 运行在同一台服务器上)。

    当您使用 Thrift 服务器连接到 HBase 时,库使用相同的 host 地址与 ZooKeeper 通信。

    hbase = happybase.Connection(host, port=port, timeout=10000)
    

    但是,如果 Thrift 服务器在单独的硬件/IP 上工作,则此 ZooKeeper 地址不正确。

    因此,您必须使用常规代码连接到 Thrift

    hbase = happybase.Connection(host, port=port, timeout=10000)
    

    但在通过hbase.zookeeper.quorum参数连接表时指定HBaseHost(ZooKeeper):

       conf = {"hbase.zookeeper.quorum": HBaseHost, "hbase.mapreduce.inputtable": table}
       rdd = spark_context.newAPIHadoopRDD(
            "org.apache.hadoop.hbase.mapreduce.TableInputFormat",
            "org.apache.hadoop.hbase.io.ImmutableBytesWritable",
            "org.apache.hadoop.hbase.client.Result",
            keyConverter=keyConv,
            valueConverter=valueConv,
            conf=conf
        )
    

    ZooKeeper 地址也可以在 hbase-site.xml 中指定为 hbase.zookeeper.quorum 属性。然后你需要在你的 HBase 客户端设置中包含这个配置文件。

    【讨论】:

      【解决方案2】:

      您是否有权访问您的集群管理器 ex。 Cloudera 经理。您可以检查 zookeeper 服务是否正常运行或那里弹出任何错误消息。

      您可以通过以下方式检查 sudo 服务动物园管理员状态

      或者您也可以通过以下方式远程登录 zookeeper 主机:

      root@host:~# telnet localhost 2181 正在尝试 127.0.0.1... 连接到我的主机。 转义字符是 '^]'。 统计数据 Zookeeper 版本:3.4.3-cdh4.0.1--1,建于 06/28/2012 23:59 GMT

      如果你在独立模式下运行,它是一个 JVM 进程,你可以通过 'jps' 检查状态

      将显示jvm进程列表;对于具有进程 ID 的 Zookeeper 来说是这样的 HQuorumPeer

      【讨论】:

        猜你喜欢
        • 2017-09-14
        • 2015-07-29
        • 1970-01-01
        • 2012-10-14
        • 2022-01-18
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2021-01-19
        相关资源
        最近更新 更多