为启用 Apache Ranger 的 Amazon EMR 集群配置 Zeppelin - Amazon EMR
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅 中国的 Amazon Web Services 服务入门 (PDF)

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

为启用 Apache Ranger 的 Amazon EMR 集群配置 Zeppelin

本主题介绍了如何为启用 Apache Ranger 的 Amazon EMR 集群配置 Apache Zeppelin,以便您可以将 Zeppelin 作为笔记本以进行交互式的数据探索。Zeppelin 包含在 Amazon EMR 发行版 5.0.0 及更高版本中。早期版本包括 Zeppelin 作为沙盒应用程序。有关更多信息,请参阅《Amazon EMR 发行版指南》中的 Amazon EMR 4.x 版本

预设情况下,Zeppelin 配置了原定设置登录名和密码,但这在多租户环境中并不安全。

要配置 Zeppelin,请完成以下步骤:

  1. 修改身份验证机制

    修改 shiro.ini 文件以实现您首选的身份验证机制。Zeppelin 支持 Active Directory、LDAP、PAM 和 Knox SSO。有关详细信息,请参阅 Apache Zeppelin 的 Apache Shiro 身份验证

  2. 配置 Zeppelin 以模拟终端用户

    如果允许 Zeppelin 模拟终端用户,则 Zeppelin 提交的任务可作为该终端用户运行。将以下配置添加到 core-site.xml

    [ { "Classification": "core-site", "Properties": { "hadoop.proxyuser.zeppelin.hosts": "*", "hadoop.proxyuser.zeppelin.groups": "*" }, "Configurations": [ ] } ]

    然后将以下配置添加至位于 /etc/hadoop/confhadoop-kms-site.xml

    [ { "Classification": "hadoop-kms-site", "Properties": { "hadoop.kms.proxyuser.zeppelin.hosts": "*", "hadoop.kms.proxyuser.zeppelin.groups": "*" }, "Configurations": [ ] } ]

    您还可以按照在控制台中重新配置实例组中的步骤,使用控制台将这些配置添加到您的 Amazon EMR 集群。

  3. 允许 Zeppelin 作为终端用户执行指令

    创建一个名为 /etc/sudoers.d/90-zeppelin-user 的文件,其中包含以下内容:

    zeppelin ALL=(ALL) NOPASSWD:ALL
  4. 修改解释器设置以在它们自己的进程中运行用户任务

    配置所有解释器以在“隔离”进程中实例化“Per User”解释器。

    Amazon EMR 和 Apache Ranger 架构图。
  5. 修改 zeppelin-env.sh

    将以下内容添加到 zeppelin-env.sh 以便 Zeppelin 以终端用户身份启动解释器:

    ZEPPELIN_IMPERSONATE_USER=`echo ${ZEPPELIN_IMPERSONATE_USER} | cut -d @ -f1` export ZEPPELIN_IMPERSONATE_CMD='sudo -H -u ${ZEPPELIN_IMPERSONATE_USER} bash -c'

    将以下内容添加到 zeppelin-env.sh 以将默认的笔记本权限改为仅对创建者只读:

    export ZEPPELIN_NOTEBOOK_PUBLIC="false"

    最后,将以下内容zeppelin-env.sh添加到第一CLASSPATH条语句之后添加 EMR RecordServer 类路径:

    export CLASSPATH="$CLASSPATH:/usr/share/aws/emr/record-server/lib/aws-emr-record-server-connector-common.jar:/usr/share/aws/emr/record-server/lib/aws-emr-record-server-spark-connector.jar:/usr/share/aws/emr/record-server/lib/aws-emr-record-server-client.jar:/usr/share/aws/emr/record-server/lib/aws-emr-record-server-common.jar:/usr/share/aws/emr/record-server/lib/jars/secret-agent-interface.jar"
  6. 重新启动 Zeppelin。

    运行以下命令以重新启动 Zeppelin:

    sudo systemctl restart zeppelin