GCP DL Image实例会自动启动Jupyter服务器,但我找不到登录令牌。

huangapple go评论57阅读模式
英文:

GCP DL Image instance automatically starts Jupyter server but I cant find login Token

问题

我刚刚使用GCP提供的deep-learning-vm镜像创建了一个VM实例。我正在尝试远程访问笔记本服务器。但是我意识到,一旦我启动VM,jupyter笔记本服务器就会启动。我可以使用external_ip:8888连接到VM的jupyter笔记本服务器。

有一个问题。通常情况下,当我们手动启动jupyter笔记本服务器时,它会提供给我们一个登录令牌。在这种情况下,我不知道令牌是什么。

第二个问题是,当我运行jupyter notebook list来查看正在运行的服务器时,什么也看不到。我也尝试使用sudo用户。没有任何正在运行的服务器的迹象。但是无论如何,我可以连接到jupyter服务器的登录页面。而且当我使用lsof -i来检查端口时,我可以看到jupyter正在监听,即使我没有手动启动它。

我尝试关闭端口,但它们在几秒后又重新启动。我不明白如何在没有令牌信息的情况下使用jupyter服务器。我尝试设置密码,但没有成功。

我尝试更改用户,关闭端口,手动运行jupyter-lab服务器。但这些都没有帮助我。

英文:

I just created a VM instance with deep-learning-vm image provided by GCP. I am trying remote access to notebook server. However I realized jupyter notebook server starts the moment I start the VM. I can use the external_ip:8888 to connect the VM's jupyter notebook server.

There is 1 issue with his. Normally when we start jupyter notebook server manually it provides us a login token. In this case I do not know what the token is.

Second issue is when i do jupyter notebook list to see running servers, i see nothing. I tried with sudo user as well. There is no trace of a running server. However I can connect to login page of jupyter server regardless. Also when i check the ports using lsof -i, I can see jupyter is listening even tho I did not started it manually.

i tried to to kill the ports but they start again after seconds. I dont understand how I am suppose to use the jupyter server without token information. I tried to setup a password but it did not worked.

I tried changing the user, killing the ports, manually running the server using jupyter-lab. However these did not help me

答案1

得分: 1

有一些需要澄清的假设。

  1. 当您使用深度学习平台时,Jupyter 是一个专用的 systemctl 服务。Jupyter 服务在此处定义:/lib/systemd/system/jupyter.service

您可以通过谷歌提供的代理 URL 访问 JupyterLab。
Jupyter 服务绑定到本地 IP 地址 (127.0.0.1) 和端口 (8080),不使用令牌。

要跟踪 Jupyter 状态,请使用:systemctl status jupyter.service

示例:

/lib/systemd/system/jupyter.service
[Unit]
Description=Jupyter 笔记本服务

[Service]
Type=simple
MemoryHigh=15348914432
MemoryMax=15398914432
ExecStartPost=/usr/bin/timeout 60 sh -c 'while ! ss -t -l -n sport = :8080 | grep -q "^LISTEN.*:8080"; do sleep 1; done'
ExecStart=/bin/bash --login -c '/opt/conda/bin/jupyter lab --config=/home/jupyter/.jupyter/jupyter_notebook_config.py'
User=jupyter
Group=jupyter
WorkingDirectory=/home/jupyter
Restart=always

[Install]
WantedBy=multi-user.target
  1. 启动 JupyterLab 并使用外部 IP 地址不是一个好的安全实践。这就是为什么我们提供代理 URL 或推荐使用 SSH 访问的原因。

  2. 您可以探索用户管理的笔记本,它们使用与深度学习 VM 映像相同的底层操作系统:

https://cloud.google.com/vertex-ai/docs/workbench/user-managed/create-new

https://cloud.google.com/deep-learning-vm/docs/cli

英文:

There is some assumptions that need clarification.

  1. When you use Deep Learning Platform, Jupyter is a dedicated systemctl service. The Jupyter service is defined here: /lib/systemd/system/jupyter.service

You can access JupyterLab through a Proxy URL provided by Google.
Jupyter Service binds to local IP address (127.0.0.1) and port (8080) and does not use a token.

To track Jupyter status use: systemctl status jupyter.service

Example:

/lib/systemd/system/jupyter.service
[Unit]
Description=Jupyter Notebook Service

[Service]
Type=simple
MemoryHigh=15348914432
MemoryMax=15398914432
ExecStartPost=/usr/bin/timeout 60 sh -c 'while ! ss -t -l -n sport = :8080 | grep -q "^LISTEN.*:8080"; do sleep 1; done'
ExecStart=/bin/bash --login -c '/opt/conda/bin/jupyter lab --config=/home/jupyter/.jupyter/jupyter_notebook_config.py'
User=jupyter
Group=jupyter
WorkingDirectory=/home/jupyter
Restart=always

[Install]
WantedBy=multi-user.target
  1. Is a not a good security practice to start JupyterLab manually and use an external IP address. This is why we provide a Proxy URL or recommend SSH access.

  2. You can explore User Managed Notebooks which uses the same underlying OS as the Deep Learning VM image:

https://cloud.google.com/vertex-ai/docs/workbench/user-managed/create-new

https://cloud.google.com/deep-learning-vm/docs/cli

huangapple
  • 本文由 发表于 2023年6月2日 12:29:45
  • 转载请务必保留本文链接:https://go.coder-hub.com/76387113.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定