gpt4 book ai didi

hadoop - Hbase MuleSoft Cloudhub 连接

转载 作者:可可西里 更新时间:2023-11-01 16:11:01 25 4
gpt4 key购买 nike

我必须将 Cloudhub 连接到 Hbase。我尝试过社区版 HBase 连接器,但没有成功。然后我尝试使用 Java 代码,但再次失败。从 HBase 团队,他们只提供了主 IP (10.99.X.X) 和端口 (2181) 和用户名 (hadoop)。

我尝试过以下选项:

通过 Java 代码:

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

        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-X-X.ap-southeast-2.compute.internal

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

当我尝试使用社区版 HBase 连接器时,出现以下异常:

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

请推荐一些方法...仪表尼勒什邮箱:bit.nilesh.kumar@gmail.com

最佳答案

看来您正在配置您的客户端以尝试连接到 private IP address 上的 zookeeper quorum (10.99.X.X)。我假设您已经设置了一个 VPC ,这是您的 CloudHub 工作人员连接到您的专用网络所必需的。

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

那么可能发生的事情是这样的:

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

不幸的是,如果发生这种情况,则需要对网络进行一些更改才能修复它。 VPC discovery form 中的常见问题解答说到私有(private) DNS:

Currently we don't have the ability to relay DNS queries to internal DNS servers. You would need to either use IP addresses or public DNS entries. Beware of connecting to systems which may redirect to a Virtual IP endpoint by using an internal DNS entry.

您可以使用公共(public) DNS 和可能的弹性 IP 来解决这个问题,但这需要您将 HBase 集群暴露给互联网。

关于hadoop - Hbase MuleSoft Cloudhub 连接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31275764/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com