<Jupyter Notebook>如何用一台服务器给多个 Jupyter 用户提供服务
2017-07-14 11:22
6025 查看
如题,搭了一个 spark 集群,在 master 上安装了 jupyter notebook. 随后发现团队有多个人想在 master 上用 jupyter 操作,又不方便大家用一个账户,于是就创建了多个账户.
方法很简单:
jupyter notebook 命令有一个 --config <config_file_path> 的可选参数,默认使用当前目录下的 jupyter_notebook_config.py,可填入 绝对路径 指定配置文件。
只要给每个用户写一个配置文件(至少端口、工作目录的配置要不同),然后分别运行 jupyter notebook --config jupyter_notebook_config_username.py 即可。
实例
文件目录:[root@master .jupyter]# ls
jupyter_notebook_config_hs.py jupyter_notebook_config.py jupyter_notebook_config.py.bak jupyter_notebook_config_zq.py migrated
其中 jupyter_notebook_config.py 是第一个用户的配置文件,jupyter_notebook_config_hs.py 是用户 hs 的配置文件,jupyter_notebook_config_zq.py 是用户 zq 的配置文件。
文件内容示例:
jupyter_notebook_config.py
1 # Configuration file for jupyter-notebook.
2 c = get_config()
3 c.IPKernelApp.pylab = 'inline'
4 c.NotebookApp.ip = '*'
5 c.NotebookApp.open_browser = False
6 c.NotebookApp.password = 'sha1:61c764d76b49:01e5f2ec3d6d0ba262b472281d025d3c4e1fe565'
7 c.NotebookApp.port = 6789
8 c.NotebookApp.notebook_dir = '/home/me/ipython'
执行 jupyter notebook & 或 jupyter note book --config /root/.jupyter/jupyter_note_book_config.py & 启动服务
客户端在浏览器上 通过 <ip地址>:6789 访问
jupyter_notebook_config_hs.py
1 # Configuration file for jupyter-notebook.
2 c = get_config()
3 c.IPKernelApp.pylab = 'inline'
4 c.NotebookApp.ip = '*'
5 c.NotebookApp.open_browser = False
6 c.NotebookApp.password = 'sha1:976bc4e3d0db:df5983c005e2d95c061426ba90c74086c57e76fd'
7 c.NotebookApp.port = 7777
8 c.NotebookApp.notebook_dir = '/home/hs/ipython'
执行 jupyter note book --config /root/.jupyter/jupyter_note_book_config_hs.py & 启动服务
客户端在浏览器上 通过 <ip地址>:7777 访问
至此,该服务器就可以给多个端口、密码不同的 jupyter notebook 用户使用了
方法很简单:
jupyter notebook 命令有一个 --config <config_file_path> 的可选参数,默认使用当前目录下的 jupyter_notebook_config.py,可填入 绝对路径 指定配置文件。
只要给每个用户写一个配置文件(至少端口、工作目录的配置要不同),然后分别运行 jupyter notebook --config jupyter_notebook_config_username.py 即可。
实例
文件目录:[root@master .jupyter]# ls
jupyter_notebook_config_hs.py jupyter_notebook_config.py jupyter_notebook_config.py.bak jupyter_notebook_config_zq.py migrated
其中 jupyter_notebook_config.py 是第一个用户的配置文件,jupyter_notebook_config_hs.py 是用户 hs 的配置文件,jupyter_notebook_config_zq.py 是用户 zq 的配置文件。
文件内容示例:
jupyter_notebook_config.py
1 # Configuration file for jupyter-notebook.
2 c = get_config()
3 c.IPKernelApp.pylab = 'inline'
4 c.NotebookApp.ip = '*'
5 c.NotebookApp.open_browser = False
6 c.NotebookApp.password = 'sha1:61c764d76b49:01e5f2ec3d6d0ba262b472281d025d3c4e1fe565'
7 c.NotebookApp.port = 6789
8 c.NotebookApp.notebook_dir = '/home/me/ipython'
执行 jupyter notebook & 或 jupyter note book --config /root/.jupyter/jupyter_note_book_config.py & 启动服务
客户端在浏览器上 通过 <ip地址>:6789 访问
jupyter_notebook_config_hs.py
1 # Configuration file for jupyter-notebook.
2 c = get_config()
3 c.IPKernelApp.pylab = 'inline'
4 c.NotebookApp.ip = '*'
5 c.NotebookApp.open_browser = False
6 c.NotebookApp.password = 'sha1:976bc4e3d0db:df5983c005e2d95c061426ba90c74086c57e76fd'
7 c.NotebookApp.port = 7777
8 c.NotebookApp.notebook_dir = '/home/hs/ipython'
执行 jupyter note book --config /root/.jupyter/jupyter_note_book_config_hs.py & 启动服务
客户端在浏览器上 通过 <ip地址>:7777 访问
至此,该服务器就可以给多个端口、密码不同的 jupyter notebook 用户使用了
相关文章推荐
- Anaconda集成的Jupyter notebook消失,该如何使用Jupyter?
- 实验教程1:如何在阿里云服务器ECS上安装anaconda,配置远程访问的jupyter notebook
- 适用小白:为什么要用Jupyter?以及,如何在Linux的Ubuntu 14.04LTS上安装和启动Jupyter Notebook
- jupyter notebook 架设在服务器 本地用浏览器访问服务器上的jupyter
- jupyter notebook 架设在服务器 在windows 本地用浏览器的访问服务器上的jupyter
- <Jupyter Notebook>无法访问/404页面/SSL ERROR (总之就是连接不上)——问题与解决方案
- SQL Server 2008 R2运行分布式的查询时的错误消息:"链接服务器 < 链接服务器 > 的 OLE DB 提供程序 SQLNCLI 返回消息没有事务处于活动状态
- 远程连接服务器jupyter notebook、浏览器以及深度学习可视化方法
- mac 下在服务器上运行 Jupyter notebook
- [完美解决]如何在windows安装docker toolbox,使用tensorflow,Jupyter Notebook,各种问题的解决方案
- 搭建 Jupyter Notebook 服务器
- [0] 服务器 TCP 提供程序无法在 [ 'any' <ipv4> *] 上侦听。TCP 端口已在使用中。
- 【手把手教你】如何在Linux系统搭建jupyter notebook
- 在服务器搭建Jupyter notebook
- conda创建的虚拟环境中使用jupyter notebook如何关闭
- Mac下Jupyter(即IPython-notebook)的搭建及使用(更建议安装Anaconda环境直接自带jupyter notebook)
- Apache服务器虚拟主机设置问题-如何使通过IP访问为默认的apache页面 <转载>
- windows远程连接服务器中的jupyter notebook
- 在jupyter notebook中同时安装python2和python3(可以在jupyter中随意切换)
- 如何修改jupyter notebook默认打开目录