【问题标题】:pig - read/write data from remote hbase serverpig - 从远程 hbase 服务器读取/写入数据
【发布时间】:2017-10-13 18:42:14
【问题描述】:

我想通过 pig 脚本从 hbase 远程服务器读取/写入数据。我们正在使用 Hortonworks HDP 2.5

以下是场景。

我们有两个集群,一个用于 Hive,一个用于 Hbase。我们可以访问作为 Hive 集群一部分的边缘节点。

我们的代码(MapReduce 作业和 Pig 脚本)将在 Hive 集群上执行。

作为要求的一部分,我们还必须从 Hbase 表中读取/写入数据。

我们在网上找到了一种解决方案,但它不起作用。 http://grokbase.com/t/cloudera/cdh-user/137at5cg72/pig-stores-into-remote-hbase

此解决方案建议在我们的 pig 脚本中注册 hbase 服务器的 zookeeper quorum。但是语法不起作用。

  set hbase.zookeeper.quorum '108.168.251.xxx-static.reverse.softlayer.com<http://108.168.251.xxx-static.reverse.softlayer.com:8020/hbase>'

...

STORE raw_rec INTO 'hbase://my_table<http://108.168.251.xxx-static.reverse.softlayer.com:8020/hbase>' USING org.apache.pig.backend.hadoop.hbase.HBaseStorage('score:val');

但这不起作用。 命名空间中只允许使用字母数字字符(不允许符号)

请告诉我们是否有任何方法可以使用默认的 org.apache.pig.backend.hadoop.hbase.hbasestorage 从 pig 内的远程 hbase 集群读取/写入数据

提前致谢!!!

【问题讨论】:

    标签: hadoop hbase apache-pig hortonworks-data-platform


    【解决方案1】:

    在安装了 pig 的客户端机器中,请进行以下设置。假设 2181 是 zk cilent 端口。

    export PIG_OPTS="$PIG_OPTS -Dhbase.zookeeper.property.clientPort=2181 -Dhbase.zookeeper.quorum=108.168.251.xxx-static.reverse.softlayer.com"
    

    然后直接使用表名,不带“hbase://”,就好像本地集群的hbase中存在my_table一样。

    STORE raw_rec INTO 'my_table' USING org.apache.pig.backend.hadoop.hbase.HBaseStorage('score:val');
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-05
      • 2022-01-03
      • 1970-01-01
      • 2010-10-13
      • 1970-01-01
      相关资源
      最近更新 更多