在浏览器中访问安装在 EMR 4.3.0 上的 Jupyter Notebook

Access Jupyter Notebook installed on EMR 4.3.0 in browser

我已经按照 EMR 页面上的步骤启动了一个 AWS EMR 集群。通过 SSH(Windows 7 中的 putty)连接并启用 foxyproxy(Chrome)后,它启动正常,可以在我的笔记本电脑浏览器中访问。 Pyspark 和 sparkR 随 EMR Spark 1.6.0 安装一起提供,并在终端中完美运行。 Hue 等的端口在以下格式下工作正常:

ec2-xx-xxx-xxx-xxx.us-west-2.compute.amazonaws.com:/

我按照 http://jupyter.readthedocs.org/en/latest/install.html#using-pip

上的步骤安装了 Jupyter
sudo pip install jupyter

我用

打开了一个新笔记本
jupyter notebook

它在我关闭的终端中打开了一个浏览器。它给出了以下输出:

[I 14:32:12.001 NotebookApp] Writing notebook server cookie secret to /home/hadoop/.local/share/jupyter/runtime/notebook_cookie_secret
[I 14:32:12.033 NotebookApp] The port 8888 is already in use, trying another random port.
[I 14:32:12.037 NotebookApp] Serving notebooks from local directory: /home/hadoop
[I 14:32:12.037 NotebookApp] 0 active kernels
[I 14:32:12.038 NotebookApp] The Jupyter Notebook is running at: http://localhost:8889/
[I 14:32:12.038 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).

我尝试通过以下方式在浏览器中访问它: localhost:8889/

(当然没用)

然后通过: ec2-xx-xxx-xxx-xxx.us-west-2.compute.amazonaws.com:8889/

(替换 x's),但这也给出了错误。

This webpage is not available

ERR_CONNECTION_RESET

那么当Jupyter安装在EMR集群的头节点后,如何在本地浏览器中访问它呢?

我还没有真正使用过 Jupyter,但我尝试像您一样安装和 运行 它,我注意到 Jupyter 默认配置为仅在本地主机上侦听,这就是为什么您可以'不要从浏览器访问它。

然后我发现 运行 "jupyter notebook --generate-config" 会生成一个配置文件 ~/.jupyter/jupyter_notebook_config.py,您可以编辑它以使其在 0.0.0.0 上侦听本地主机。只需将 c.NotebookApp.ip 更改为“0.0.0.0”并取消注释该行即可。

完成此操作后,我可以使用 http://ip-10-168-157-117.ec2.internal:8888/ 之类的 URL 从我的浏览器访问 Jupyter。 (我的默认情况下在端口 8888 上侦听,但我假设你的开始在端口 8889 上,因为已经安装了 Hue 并在端口 8888 上侦听。)