[英]Hbase MuleSoft Cloudhub Connectivity
我必須將Cloudhub連接到Hbase。 我試過社區版HBase連接器,但未成功。 然后,我嘗試使用Java代碼,但再次失敗。 在HBase團隊中,他們僅提供了主IP(10.99.XX)和端口(2181)以及用戶名(hadoop)。
我嘗試了以下選項:
通過Java代碼:
公共對象transformMessage(MuleMessage消息,字符串outputEncoding)引發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-XX.ap-southeast-2.compute.internal
似乎CloudHub無法找到主機名,因為cloudHub沒有配置DNS
當我嘗試使用Community Edition HBase Connector時,出現以下異常:
org.apache.hadoop.hbase.MasterNotRunningException:重試3次
請提出一些建議... Rgeards Nilesh電子郵件:bit.nilesh.kumar@gmail.com
我相信您的問題的答案已在cloudhub網絡指南中涵蓋。
https://developer.mulesoft.com/docs/display/current/CloudHub+Networking+Guide
似乎您正在配置客戶端,以嘗試通過專用IP地址 (10.99.XX)連接到zookeeper仲裁。 我假設您已經設置了VPC ,這是CloudHub工作者連接到專用網絡所必需的。
您的UnknownHostException表示您要連接的HBase服務器托管在AWS上,該服務器定義的私有域名類似於錯誤消息中的私有域名。
因此,可能會發生以下情況:
ip-10-99-XX.ap-southeast-2.compute.internal
。 不幸的是,如果正在發生這種情況,則需要進行一些網絡更改才能修復它。 VPC發現表單中的FAQ說明了有關私有DNS的信息:
目前,我們無法將DNS查詢中繼到內部DNS服務器。 您將需要使用IP地址或公共DNS條目。 當心連接到可以使用內部DNS條目重定向到虛擬IP端點的系統。
您可以使用公共DNS並可能使用彈性IP來解決此問題,但這將要求您將HBase群集公開到Internet。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.