簡體   English   中英

MapReduce作業無法與啟用Kerberos的CDH群集上的Hbase進行通信

[英]MapReduce job can't talk with Hbase on a Kerberos enabled CDH cluster

我正在編寫一個MapReduce應用程序,以在啟用Kerberos的情況下訪問CDH群集上的Hbase數據。 我的CDH版本是5.9.0,可在3個節點上運行,而Kerberos版本是1.10.1。 現在,我面臨一個問題,希望有人能提供幫助。

我的代碼:

conf.set("hadoop.security.authentication", "Kerberos");
UserGroupInformation.setConfiguration(conf);
UserGroupInformation.loginUserFromKeytab("jj@example.com", "jj.keytab");

HTable table = new HTable(conf, "myTable");
 Put p = new Put(Bytes.toBytes("myLittleRow"));
 p.add(Bytes.toBytes("myColumnFamily"), Bytes.toBytes("someQualifier"),
         Bytes.toBytes("Some Value"));
 table.put(p);

上面的代碼幫助我使用java -jarhadoop -jar本地模式下成功運行。 但是,當我嘗試通過Hue使用Oozie Workflow運行時,會發生以下問題:

FATAL [main] org.apache.hadoop.hbase.ipc.RpcClientImpl: SASL authentication failed. The most likely cause is missing or invalid credentials. Consider 'kinit'. javax.security.sasl.SaslException: GSS initiate failed [Caused by GSSException: No valid credentials provided (Mechanism level: Failed to find any Kerberos tgt)]
Caused by: GSSException: No valid credentials provided (Mechanism level: Failed to find any Kerberos tgt)

因此,我嘗試使用初始化憑據來獲取有效令牌以通過以下方式運行作業

TableMapReduceUtil.initCredentialsForCluster(job,conf);

但問題仍然存在。 有人有什么主意嗎?

終於我找到了解決方案。 在CDH上配置Hue-Ozzie作業以與安全的Hbase對話很容易。

您需要做的只是:

  • 設置工作流程時啟用Hbase憑據
  • hbase-site.xml添加到job.xml路徑

盡管Oozie文檔很丑陋,但確實涵蓋了HBase Kerberos身份驗證:
https://oozie.apache.org/docs/4.2.0/DG_ActionAuthentication.html

...某些操作需要與外部服務(例如HCatalog,HBase Region Server,Hive Server 2)進行通信,在這些情況下,這些操作需要在Oozie中進行一些額外的配置以進行身份​​驗證

不幸的是,該頁面之后沒有可操作的信息。 您必須還原為舊的Google搜索才能找到一些有用的帖子,例如: https : //community.hortonworks.com/content/supportkb/49407/how-to-set-up-oozie-to-connect- to-secured-hbase-cl-1.html

至於Hue UI如何支持該功能...老實說,我在2014年試了幾天這個糟糕的軟件,然后我改用文本編輯器直接制作XML腳本。 色相的限制太多。


否則,您可以使用Hadoop UserGroupInformation.loginUserFromKeytab()和keytab文件(必須通過Oozie操作中的標准<file>指令下載 UserGroupInformation.loginUserFromKeytab()使用Java代碼中的顯式Kerberos身份驗證

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM