我有一个独立的 Flink 安装,我想在其上运行一个将数据写入 HDFS 安装的流作业。 HDFS 安装是 Cloudera 部署的一部分,需要 Kerberos 身份验证才能读取和写入 HDFS。由于我没有找到有关如何使 Flink 与受 Kerberos 保护的 HDFS 连接的文档,因此我不得不对该过程做出一些有根据的猜测。这是我到目前为止所做的:
- 我为我的用户创建了一个密钥表文件。
-
在我的 Flink 工作中,我添加了以下代码:
UserGroupInformation.loginUserFromKeytab("myusername", "/path/to/keytab");
最后我用的是TextOutputFormat
将数据写入HDFS。
当我运行该作业时,出现以下错误:
org.apache.hadoop.security.AccessControlException: SIMPLE authentication is not enabled. Available:[TOKEN, KERBE
ROS]
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
at org.apache.hadoop.ipc.RemoteException.instantiateException(RemoteException.java:106)
at org.apache.hadoop.ipc.RemoteException.unwrapRemoteException(RemoteException.java:73)
at org.apache.hadoop.hdfs.DFSOutputStream.newStreamForCreate(DFSOutputStream.java:1730)
at org.apache.hadoop.hdfs.DFSClient.create(DFSClient.java:1668)
at org.apache.hadoop.hdfs.DFSClient.create(DFSClient.java:1593)
at org.apache.hadoop.hdfs.DistributedFileSystem$6.doCall(DistributedFileSystem.java:397)
at org.apache.hadoop.hdfs.DistributedFileSystem$6.doCall(DistributedFileSystem.java:393)
at org.apache.hadoop.fs.FileSystemLinkResolver.resolve(FileSystemLinkResolver.java:81)
at org.apache.hadoop.hdfs.DistributedFileSystem.create(DistributedFileSystem.java:393)
at org.apache.hadoop.hdfs.DistributedFileSystem.create(DistributedFileSystem.java:337)
at org.apache.hadoop.fs.FileSystem.create(FileSystem.java:908)
at org.apache.hadoop.fs.FileSystem.create(FileSystem.java:889)
at org.apache.hadoop.fs.FileSystem.create(FileSystem.java:786)
at org.apache.flink.runtime.fs.hdfs.HadoopFileSystem.create(HadoopFileSystem.java:405)
由于某些奇怪的原因,Flink 似乎尝试了简单的身份验证,即使我打电话给loginUserFromKeytab
。我在 Stackoverflow 上发现了另一个类似的问题(在 YARN 集群 (Cloudera) 上执行 Flink 示例代码时出现 Kerberos 身份验证错误 https://stackoverflow.com/questions/32085990/error-with-kerberos-authentication-when-executing-flink-example-code-on-yarn-clu)其中有一个答案解释说:
如果用户在所有工作节点上进行了身份验证,独立 Flink 目前仅支持访问 Kerberos 安全的 HDFS。
这可能意味着我必须在操作系统级别进行一些身份验证,例如和kinit
。由于我对 Kerberos 的了解非常有限,我不知道该怎么做。我也想了解程序如何运行kinit
当没有任何相关配置时,实际上知道从本地缓存中选择哪个 Kerberos 票证。
我不是 Flink 用户,但根据我在 Spark 和朋友身上看到的情况,我的猜测是“在所有工作节点上进行身份验证”意思是each工作进程有
a core-site.xml
配置可在本地文件系统上使用hadoop.security.authentication
set to kerberos
(除其他外
事物)
本地目录包含core-site.xml
添加到 CLASSPATH 以便 Hadoop 自动找到它Configuration
object [否则它将默默地恢复为默认的硬编码值,呃]
- 隐式身份验证通过
kinit
和默认缓存[为 Linux 帐户全局设置 TGT,影响所有进程,呃]## 或 ## 隐式身份验证通过kinit
以及通过 KRB5CCNAME 环境变量设置的“私有”缓存(Hadoop 仅支持“FILE:”类型)## 或 ## 通过显式身份验证UserGroupInformation.loginUserFromKeytab()
以及本地文件系统上可用的密钥表
UGI“登录”方法非常冗长,因此如果在 Flink 尝试从 HDFS 客户端启动之前确实调用了该方法,Configuration
,你会注意到。另一方面,如果您没有看到详细的内容,那么您创建私有 Kerberos TGT 的尝试会被 Flink 绕过,您必须找到一种方法来绕过 Flink:-/
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)