首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >专栏 >JupyterHub与OpenLDAP集成

JupyterHub与OpenLDAP集成

作者头像
Fayson
发布2018-09-29 11:00:49
发布2018-09-29 11:00:49
3.4K00
代码可运行
举报
文章被收录于专栏:Hadoop实操Hadoop实操
运行总次数:0
代码可运行

1.文档编写目的


Fayson在前面文章《如何在非安全的CDH集群中部署Jupyter并集成Spark2》及《如何在非安全的CDH集群中部署多用户JupyterHub服务并集成Spark2》中介绍了Jupyter与JupyterHub的部署与Spark2集成。JupyterHub的用户默认是基于OS系统用户,对于用户的管理和维护都需要在服务器上进行操作不便于管理。本篇文章Fayson主要介绍在JupyterHub中如何与OpenLDAP服务集成。

  • 测试环境

1.CM5.15.0和CDH版本5.14.2

2.JupyterHub版本为0.9.2

3.Python版本为3.6.5

  • 前置条件

1.JupyterHub已部署成功

2.JupyterHub与OpenLDAP集成


在JupyterHub中默认只支持操作系统PAM默认的认证方式,如果需要JupyterHub支持OpenLDAP认证,则需要安装OpenLDAP认证的插件,插件地址:https://github.com/jupyterhub/ldapauthenticator

1.在Python3环境中安装jupyterhub-ldapauthenticator包,命令如下:

代码语言:javascript
代码运行次数:0
运行
复制
[root@cdh03 ~]# /opt/cloudera/anaconda3/bin/pip install jupyterhub-ldapauthenticator

(可左右滑动)

安装完成后验证是否安装成功

代码语言:javascript
代码运行次数:0
运行
复制
[root@cdh03 ~]# /opt/cloudera/anaconda3/bin/pip show jupyterhub-ldapauthenticator

(可左右滑动)

2.修改/etc/jupyterhub/jupyterhub_config.py文件,增加OpenLDAP配置,在文件默认增加内容如下:

代码语言:javascript
代码运行次数:0
运行
复制
#指定JupyterHub认证类型
c.JupyterHub.authenticator_class = 'ldapauthenticator.LDAPAuthenticator'
#OpenLDAP服务地址
c.LDAPAuthenticator.server_address = 'ldap://cdh01.fayson.com'
#访问用户和组的DN
c.LDAPAuthenticator.bind_dn_template = [
    "uid={username},ou=People,dc=fayson,dc=com",
    "uid={username},ou=Group,dc=fayson,dc=com"
]

(可左右滑动)

3.启动Jupyterhub服务

代码语言:javascript
代码运行次数:0
运行
复制
[root@cdh03 jupyterhub]# /opt/cloudera/anaconda3/bin/jupyterhub -f /etc/jupyterhub/jupyterhub_config.py --debug

(可左右滑动)

如上显示启动成功,在启动命令后添加--debug参数可以显示DEBUG日志,-f指定JupyterHub启动加载的配置文件。

3.集成验证


1.在OpenLDAP上创建一个testldap测试用户

2.在浏览器输入http://cdh03.fayson.com:8000访问JupyterHub,使用testldap用户登录

登录成功

打开一个Notebook,并运行一段测试的pyspark代码

查看Yarn上的作业

4.总结


1.JupyterHub与OpenLDAP集成需要安装jupyterhub-ldapauthenticator插件。

2.可以通过配置Group限制访问JupyterHub的用户组,更多配置可参考GitHub:https://github.com/jupyterhub/ldapauthenticator

本文参与 腾讯云自媒体同步曝光计划,分享自微信公众号。
原始发表:2018-09-09,如有侵权请联系 [email protected] 删除

本文分享自 Hadoop实操 微信公众号,前往查看

如有侵权,请联系 [email protected] 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档