无法连接到 GCP 集群虚拟机

Can't connect to GCP cluster VM

我正在关注此 tutorial,但无法使用 SSH 端口转发连接到 GCP VM 集群。

我运行这个命令行:

$ gcloud compute ssh cluster-5b2b-m --zone=asia-northeast2-b \
--project=*** -- -L 8787:localhost:8787

但是当我尝试打开 http://localhost:8787 在浏览器中我收到一条错误消息 This site can't be reached

有什么建议吗?

是的, 问题是您正尝试在浏览器中访问 "localhost" 但您的集群在 gcloud 中。

您可以尝试使用 Rstudio 访问:http://[CLUSTER_NAME]-m:8787 as the tutorial suggests, or http://[CLUSTER_NAME]-m:8088 从浏览器访问,如果配置正确应该可以。

在示例中,完整命令应如下所示,然后 gcloud 将打开一个通往您的集群的隧道。我想你忘记输入 [CLUSTER_NAME]-m

gcloud compute ssh \
    --zone=[CLUSTER_ZONE] \
    --project=[PROJECT_ID] \
    [CLUSTER_NAME]-m -- \
    -L 8787:localhost:8787