我有一个Jupiter笔记本在AWS的Ubuntu服务器上运行。
docker run -d -p 8880:8888 jupyter/all-spark-notebook
我能够很好地看到Web界面,并且我已经闯入了容器并获得了登录令牌。看起来不错然而,在网页界面的底部它说
Python 3 (ipykernel)|Disconnected
运行以下行:
docker logs --tail -50 [container ID]
我得到:
[I 2023-04-24 17:57:38.251 ServerApp] Kernel started: 26f0e339-31c1-4fc6-8bf0-4208454c652f
[I 2023-04-24 17:57:38.252 ServerApp] Kernel shutdown: 3b58c1be-aba7-4c0a-9082-f4cfb1252c02
[W 2023-04-24 17:57:42.447 ServerApp] 400 GET /api/kernels/26f0e339-31c1-4fc6-8bf0-4208454c652f/channels?session_id=41770cc1-2ec4-4827-8769-25f415657ee8 (619eb7cca8e94cf78a766772e4d1a559@172.17.0.1) 10.54ms referer=None
[W 2023-04-24 17:57:43.223 ServerApp] 400 GET /api/kernels/26f0e339-31c1-4fc6-8bf0-4208454c652f/channels?session_id=0ab9b092-1a9a-4e13-a5b6-c18a343b7969 (619eb7cca8e94cf78a766772e4d1a559@172.17.0.1) 2.23ms referer=None
[W 2023-04-24 17:57:44.921 ServerApp] Replacing stale connection: 26f0e339-31c1-4fc6-8bf0-4208454c652f:41770cc1-2ec4-4827-8769-25f415657ee8
[W 2023-04-24 17:57:44.922 ServerApp] 400 GET /api/kernels/26f0e339-31c1-4fc6-8bf0-4208454c652f/channels?session_id=41770cc1-2ec4-4827-8769-25f415657ee8 (619eb7cca8e94cf78a766772e4d1a559@172.17.0.1) 2.54ms referer=None
[W 2023-04-24 17:57:47.883 ServerApp] Replacing stale connection: 26f0e339-31c1-4fc6-8bf0-4208454c652f:0ab9b092-1a9a-4e13-a5b6-c18a343b7969
[W 2023-04-24 17:57:47.884 ServerApp] 400 GET /api/kernels/26f0e339-31c1-4fc6-8bf0-4208454c652f/channels?session_id=0ab9b092-1a9a-4e13-a5b6-c18a343b7969 (619eb7cca8e94cf78a766772e4d1a559@172.17.0.1) 2.31ms referer=None
[W 2023-04-24 17:57:49.846 ServerApp] Replacing stale connection: 26f0e339-31c1-4fc6-8bf0-4208454c652f:41770cc1-2ec4-4827-8769-25f415657ee8
[W 2023-04-24 17:57:49.847 ServerApp] 400 GET /api/kernels/26f0e339-31c1-4fc6-8bf0-4208454c652f/channels?session_id=41770cc1-2ec4-4827-8769-25f415657ee8 (619eb7cca8e94cf78a766772e4d1a559@172.17.0.1) 2.57ms referer=None
[W 2023-04-24 17:57:53.474 ServerApp] Replacing stale connection: 26f0e339-31c1-4fc6-8bf0-4208454c652f:0ab9b092-1a9a-4e13-a5b6-c18a343b7969
[W 2023-04-24 17:57:53.475 ServerApp] 400 GET /api/kernels/26f0e339-31c1-4fc6-8bf0-4208454c652f/channels?session_id=0ab9b092-1a9a-4e13-a5b6-c18a343b7969 (619eb7cca8e94cf78a766772e4d1a559@172.17.0.1) 2.37ms referer=None
[W 2023-04-24 17:57:53.659 ServerApp] 400 GET /api/events/subscribe?token=[secret] (619eb7cca8e94cf78a766772e4d1a559@172.17.0.1) 1.24ms referer=None
[W 2023-04-24 17:57:54.621 ServerApp] Replacing stale connection: 26f0e339-31c1-4fc6-8bf0-4208454c652f:41770cc1-2ec4-4827-8769-25f415657ee8
[W 2023-04-24 17:57:54.622 ServerApp] 400 GET /api/kernels/26f0e339-31c1-4fc6-8bf0-4208454c652f/channels?session_id=41770cc1-2ec4-4827-8769-25f415657ee8 (619eb7cca8e94cf78a766772e4d1a559@172.17.0.1) 2.47ms referer=None
[W 2023-04-24 17:57:56.044 ServerApp] Replacing stale connection: 26f0e339-31c1-4fc6-8bf0-4208454c652f:0ab9b092-1a9a-4e13-a5b6-c18a343b7969
[W 2023-04-24 17:57:56.045 ServerApp] 400 GET /api/kernels/26f0e339-31c1-4fc6-8bf0-4208454c652f/channels?session_id=0ab9b092-1a9a-4e13-a5b6-c18a343b7969 (619eb7cca8e94cf78a766772e4d1a559@172.17.0.1) 2.61ms referer=None
[W 2023-04-24 17:58:01.418 ServerApp] Replacing stale connection: 26f0e339-31c1-4fc6-8bf0-4208454c652f:0ab9b092-1a9a-4e13-a5b6-c18a343b7969
[W 2023-04-24 17:58:01.425 ServerApp] 400 GET /api/kernels/26f0e339-31c1-4fc6-8bf0-4208454c652f/channels?session_id=0ab9b092-1a9a-4e13-a5b6-c18a343b7969 (619eb7cca8e94cf78a766772e4d1a559@172.17.0.1) 14.36ms referer=None
[W 2023-04-24 17:58:02.346 ServerApp] Replacing stale connection: 26f0e339-31c1-4fc6-8bf0-4208454c652f:41770cc1-2ec4-4827-8769-25f415657ee8
[W 2023-04-24 17:58:02.347 ServerApp] 400 GET /api/kernels/26f0e339-31c1-4fc6-8bf0-4208454c652f/channels?session_id=41770cc1-2ec4-4827-8769-25f415657ee8 (619eb7cca8e94cf78a766772e4d1a559@172.17.0.1) 2.54ms referer=None
[W 2023-04-24 17:58:03.855 ServerApp] 400 GET /api/events/subscribe?token=[secret] (619eb7cca8e94cf78a766772e4d1a559@172.17.0.1) 1.23ms referer=None
[W 2023-04-24 17:58:10.132 ServerApp] Replacing stale connection: 26f0e339-31c1-4fc6-8bf0-4208454c652f:0ab9b092-1a9a-4e13-a5b6-c18a343b7969
[W 2023-04-24 17:58:10.133 ServerApp] 400 GET /api/kernels/26f0e339-31c1-4fc6-8bf0-4208454c652f/channels?session_id=0ab9b092-1a9a-4e13-a5b6-c18a343b7969 (619eb7cca8e94cf78a766772e4d1a559@172.17.0.1) 2.55ms referer=None
我所读到的内容表明,这是我的Apache2反向代理和Jupyter使用websockets的问题。所以,我这样配置代理(每https://httpd.apache.org/docs/2.4/mod/mod_proxy_wstunnel.html):
<VirtualHost *:8888>
ServerName host.domain.com
<IfModule mod_ssl.c>
SSLEngine on
SSLCertificateFile /etc/letsencrypt/live/host.domain.com/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/host.domain.com/privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live/host.domain.com/fullchain.pem
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
ProxyPreserveHost On
ProxyRequests Off
ProxyVia On
ProxyPass / http://localhost:8880/
ProxyPassReverse / http://localhost:8880/
RewriteEngine on
RewriteCond ${HTTP:Upgrade} websocket [NC]
RewriteCond ${HTTP:Connection} upgrade [NC]
RewriteRule ^/?(.*) "ws://localhost:8880/$1" [P,L]
# RequestHeader set "X-Forwarded-Proto" expr=%{REQUEST_SCHEME}
# RequestHeader set "X-Forwarded-SSL" expr=%{HTTPS}
</IfModule>
</VirtualHost>
重写模式已启用。重新启动Apache后,没有任何变化。我得到相同的日志输出,笔记本仍然没有连接到终端。同样的结果,如果我使用基地笔记本电脑。我错过了什么?
1条答案
按热度按时间qlzsbp2j1#
经过大量的实验,我发现下面的配置可以代理内核的WebSocket:
以下是有助于故障排除的命令: