python webhdfs kerberos不工作

2024-09-29 23:25:10 发布

您现在位置:Python中文网/ 问答频道 /正文

我需要帮助,我正在使用webhdfs(也使用这个python代码来调用hadoop命令https://gist.github.com/drelu/1529478)。对于我的系统,它是使用KDC进行kerberized的。我可以执行curl,但不知道如何在上面的python代码中使用curl命令。感谢你的帮助。我的curl命令如下所示:

curl—cacert/opt/cloudera/security/CAcerts/根C.cer--协商-uhttps://localhost:140000/webhdfs/v1/?op=liststatus

谢谢


Tags: 代码https命令githubcomhadoop系统curl
1条回答
网友
1楼 · 发布于 2024-09-29 23:25:10

有几种方法可以做到这一点

  1. With pywebhdfs python client https://github.com/pywebhdfs/pywebhdfs/issues/16#issuecomment-243776503
  2. Without pywebhdfs directly calling the webhdfs REST calls
    Example code: https://plenium.wordpress.com/2018/07/26/run-a-python-program-to-access-hadoop-with-kerberos-enabled/

在这两种方法中,您需要使用requests\kerberos modulehttps://github.com/requests/requests-kerberos#requests-kerberosgssapi-authentication-library创建身份验证头

  1. hdfscli python module can be used https://hdfscli.readthedocs.io/en/latest/

在所有情况下,kinit都需要手动完成(您可以使用一些pythonshell执行器模块,比如subprocess、commands。。自动执行)

相关问题 更多 >

    热门问题