停止集群后无法在 Google Cloud Dataproc 集群上重新打开 Jupyter 笔记本
Cannot reopen Jupyter notebooks on Google Cloud Dataproc cluster after stopping cluster
我正在使用 Google Cloud Dataproc 来 运行 Jupyter notebook(遵循这些说明:https://cloud.google.com/dataproc/docs/tutorials/jupyter-notebook)。
我 运行 一个笔记本,保存了它,然后在稍后的某个时候停止了集群(使用 GUI)。然后我重新启动集群并尝试使用相同的指令再次 运行 Jupyter notebook 但在最后一步,当我尝试在 Chrome 中打开 Jupyter 时,我得到:
"This site can't be reached. The webpage at http://<my-cluster-name>:8123/ might be temporarily down or it may have moved permanently to a new web address. ERR_SOCKS_CONNECTION_FAILED."
此外(我不知道这是否有帮助)在我配置浏览器的终端 window 中,我收到一条消息:
ERROR:child_thread_impl.cc(762)] Request for unknown Channel-associated interface: ui::mojom::GpuMain
Google Chrome[695:8548] NSWindow warning: adding an unknown subview: <FullSizeContentView: 0x7fdfd3e291e0>. Break on NSLog to debug.
Google Chrome[695:8548] Call stack:
(
"+callStackSymbols disabled for performance reasons"
)
在我通过 ssh 连接到我的集群的终端 window 中,我收到了这些消息:
channel 3: open failed: connect failed: Connection refused
channel 4: open failed: connect failed: Connection refused
channel 5: open failed: connect failed: Connection refused
channel 6: open failed: connect failed: Connection refused
channel 12: open failed: connect failed: Connection refused
channel 12: open failed: administratively prohibited: open failed
channel 13: open failed: administratively prohibited: open failed
channel 14: open failed: administratively prohibited: open failed
channel 14: open failed: connect failed: Connection refused
channel 8: open failed: connect failed: Connection refused
此外,在停止集群之前,我可以关闭 jupyter notebooks,断开与集群的连接,然后重新打开 jupyter notebook。我停止集群后才 运行 遇到这个问题。有什么想法吗?
这是因为当前initialization action explicitly launches the jupyter notebook service calling launch-jupyter-kernel.sh。初始化操作与 GCE 启动脚本不同,因为它们不会在启动时重新 运行;通常的意图是初始化操作不需要是幂等的,但是如果他们想在启动时重新启动需要添加一些初始化。d/systemd 配置来明确地这样做。
对于一次性情况,您可以直接通过 SSH 连接到 master,然后执行:
sudo su
source /etc/profile.d/conda.sh
nohup jupyter notebook --allow-root --no-browser >> /var/log/jupyter_notebook.log 2>&1 &
如果您希望它在启动时自动发生,您可以尝试将它放在 startup script via GCE metadata 中,但如果您在集群创建时这样做,您需要确保它不会' t 与 Dataproc 初始化操作发生冲突(此外,启动脚本可能 运行 在 dataproc 初始化操作之前,因此您可能只想让第一次尝试静默失败)。
从长远来看,我们应该更新初始化操作以将条目添加到 init.d/systemd 以便 init 操作本身配置重启时自动重启。目前没有人致力于此,但如果您或您认识的任何人能胜任这项任务,我们将非常感谢您的贡献;我提交了 https://github.com/GoogleCloudPlatform/dataproc-initialization-actions/issues/108 来跟踪此功能。
我通过使用 ssh 连接到 master 机器并创建了一个 systemd 服务解决了这个问题(按照 dennis-huo 上面的评论)。
- 转到/usr/lib/systemd/system
- sudo su
创建名为 "jupyter-notebook.service" 的系统单元文件,内容为
[Unit]
Description=Start Jupyter Notebook Server at reboot
[Service]
Type=simple
ExecStart=/opt/conda/bin/jupyter notebook --allow-root --no-browser
[Install]
WantedBy=multi-user.target
systemctl daemon-reload
- systemctl 启用 jupyter-notebook.service
- systemctl 启动 jupyter-notebook.service
下一步将把上述代码包含到 dataproc-initialization-actions 中。
希望对您有所帮助。
我正在使用 Google Cloud Dataproc 来 运行 Jupyter notebook(遵循这些说明:https://cloud.google.com/dataproc/docs/tutorials/jupyter-notebook)。
我 运行 一个笔记本,保存了它,然后在稍后的某个时候停止了集群(使用 GUI)。然后我重新启动集群并尝试使用相同的指令再次 运行 Jupyter notebook 但在最后一步,当我尝试在 Chrome 中打开 Jupyter 时,我得到:
"This site can't be reached. The webpage at http://<my-cluster-name>:8123/ might be temporarily down or it may have moved permanently to a new web address. ERR_SOCKS_CONNECTION_FAILED."
此外(我不知道这是否有帮助)在我配置浏览器的终端 window 中,我收到一条消息:
ERROR:child_thread_impl.cc(762)] Request for unknown Channel-associated interface: ui::mojom::GpuMain
Google Chrome[695:8548] NSWindow warning: adding an unknown subview: <FullSizeContentView: 0x7fdfd3e291e0>. Break on NSLog to debug.
Google Chrome[695:8548] Call stack:
(
"+callStackSymbols disabled for performance reasons"
)
在我通过 ssh 连接到我的集群的终端 window 中,我收到了这些消息:
channel 3: open failed: connect failed: Connection refused
channel 4: open failed: connect failed: Connection refused
channel 5: open failed: connect failed: Connection refused
channel 6: open failed: connect failed: Connection refused
channel 12: open failed: connect failed: Connection refused
channel 12: open failed: administratively prohibited: open failed
channel 13: open failed: administratively prohibited: open failed
channel 14: open failed: administratively prohibited: open failed
channel 14: open failed: connect failed: Connection refused
channel 8: open failed: connect failed: Connection refused
此外,在停止集群之前,我可以关闭 jupyter notebooks,断开与集群的连接,然后重新打开 jupyter notebook。我停止集群后才 运行 遇到这个问题。有什么想法吗?
这是因为当前initialization action explicitly launches the jupyter notebook service calling launch-jupyter-kernel.sh。初始化操作与 GCE 启动脚本不同,因为它们不会在启动时重新 运行;通常的意图是初始化操作不需要是幂等的,但是如果他们想在启动时重新启动需要添加一些初始化。d/systemd 配置来明确地这样做。
对于一次性情况,您可以直接通过 SSH 连接到 master,然后执行:
sudo su
source /etc/profile.d/conda.sh
nohup jupyter notebook --allow-root --no-browser >> /var/log/jupyter_notebook.log 2>&1 &
如果您希望它在启动时自动发生,您可以尝试将它放在 startup script via GCE metadata 中,但如果您在集群创建时这样做,您需要确保它不会' t 与 Dataproc 初始化操作发生冲突(此外,启动脚本可能 运行 在 dataproc 初始化操作之前,因此您可能只想让第一次尝试静默失败)。
从长远来看,我们应该更新初始化操作以将条目添加到 init.d/systemd 以便 init 操作本身配置重启时自动重启。目前没有人致力于此,但如果您或您认识的任何人能胜任这项任务,我们将非常感谢您的贡献;我提交了 https://github.com/GoogleCloudPlatform/dataproc-initialization-actions/issues/108 来跟踪此功能。
我通过使用 ssh 连接到 master 机器并创建了一个 systemd 服务解决了这个问题(按照 dennis-huo 上面的评论)。
- 转到/usr/lib/systemd/system
- sudo su
创建名为 "jupyter-notebook.service" 的系统单元文件,内容为
[Unit] Description=Start Jupyter Notebook Server at reboot [Service] Type=simple ExecStart=/opt/conda/bin/jupyter notebook --allow-root --no-browser [Install] WantedBy=multi-user.target
systemctl daemon-reload
- systemctl 启用 jupyter-notebook.service
- systemctl 启动 jupyter-notebook.service
下一步将把上述代码包含到 dataproc-initialization-actions 中。 希望对您有所帮助。