1

我必须将 Cloudhub 连接到 Hbase。我已经尝试过社区版 HBase 连接器,但没有成功。然后我尝试使用 Java Code 并再次失败。从 HBase 团队,他们只给出了 Master IP (10.99.XX) 和 Port(2181) 和 userName (hadoop)。

我尝试了以下选项:

通过Java代码:

public Object transformMessage(MuleMessage message, String outputEncoding) throws TransformerException { try {

        Configuration conf = HBaseConfiguration.create();
        //conf.set("hbase.rotdir", "/hbase");
        conf.set("hbase.zookeeper.quorum", "10.99.X.X");
        conf.set("hbase.zookeeper.property.clientPort", "2181");
        conf.set("hbase.client.retries.number", "3");
        logger.info("############# Config Created ##########");
        // Create a get api for consignment table
        logger.info("############# Starting Consignment Test  ##########");
        // read from table
        // Creating a HTable instance
        HTable table = new HTable(conf, "consignment");
        logger.info("############# HTable instance Created ##########");
        // Create a Get object
        Get get = new Get(Bytes.toBytes("6910358750"));
        logger.info("############# RowKey Created ##########");
        // Set column family to be queried
        get.addFamily(Bytes.toBytes("consignment_detail"));
        logger.info("############# CF Created ##########");
        // Perform get and capture result in a iterable
        Result result = table.get(get);
        logger.info("############# Result Created ##########");
        // Print consignment data
        logger.info(result);

        logger.info(" #### Ending Consignment Test ###");

        // Begining Consignment Item Scanner api
        logger.info("############# Starting Consignmentitem test ##########");

        HTable table1 = new HTable(conf, "consignmentitem");
        logger.info("############# HTable instance Created ##########");
        // Create a scan object with start rowkey and end rowkey (partial
        // row key scan)
        // actual rowkey design: <consignment_id>-<trn>-<orderline>
        Scan scan = new Scan(Bytes.toBytes("6910358750"),Bytes.toBytes("6910358751"));
        logger.info("############# Partial RowKeys Created ##########");
        // Perform a scan using start and stop rowkeys
        ResultScanner scanner = table1.getScanner(scan);
        // Iterate over result and print them
        for (Result result1 = scanner.next(); result1 != null; result1 = scanner.next()) {
            logger.info("Printing Records\n");
            logger.info(result1);
        }
        return scanner;
    }  catch (MasterNotRunningException e) {
        logger.error("HBase connection failed! --> MasterNotRunningException");
        logger.error(e);
    } catch (ZooKeeperConnectionException e) {
        logger.error("Zookeeper connection failed! -->ZooKeeperConnectionException");
        logger.error(e);
    } catch (Exception e) {
        logger.error("Main Exception Found! -- Exception");
        logger.error(e);
    }
    return "Not Connected";

}

以上代码给出以下错误

java.net.UnknownHostException:未知主机:ip-10-99-XX.ap-southeast-2.compute.internal

似乎 CloudHub 无法找到主机名,因为 cloudHub 未配置 DNS

当我尝试使用 Community Edition HBase 连接器时,它给出了以下异常:

org.apache.hadoop.hbase.MasterNotRunningException:重试 3 次

请提出一些建议... Rgeards Nilesh 电子邮件:bit.nilesh.kumar@gmail.com

4

2 回答 2

0

我相信您的问题的答案已包含在 cloudhub 网络指南中。

https://developer.mulesoft.com/docs/display/current/CloudHub+Networking+Guide

于 2015-07-07T21:30:20.500 回答
0

您似乎正在将客户端配置为尝试以私有 IP 地址(10.99.XX) 连接到 zookeeper quorum。我假设您已经设置了一个VPC,这是您的 CloudHub 工作人员连接到您的专用网络所必需的。

您的 UnknownHostException 意味着您要连接的 HBase 服务器托管在 AWS 上,它定义了类似于错误消息中的私有域名。

所以可能发生的事情是这样的:

  1. Mule 连接到 Zookeeper,询问有哪些 HBase 节点,然后返回ip-10-99-X-X.ap-southeast-2.compute.internal
  2. Mule 尝试连接到它以查找 HTable“寄售”,但无法解析该名称的 IP 地址。

不幸的是,如果这是正在发生的事情,则需要进行一些网络更改才能修复它。VPC 发现表单中的常见问题解答是关于私有 DNS 的:

目前,我们无法将 DNS 查询中继到内部 DNS 服务器。您将需要使用 IP 地址或公共 DNS 条目。当心连接到可能通过使用内部 DNS 条目重定向到虚拟 IP 端点的系统。

您可以使用公共 DNS 和可能的弹性 IP 来解决此问题,但这需要您将 HBase 集群公开到 Internet。

于 2015-07-09T04:37:09.087 回答