简体   繁体   English

无法通过 ssh 连接到 Google Cloud Dataproc 的主节点,但可以通过 ssh 连接到 Compute Engine VM

[英]Unable to ssh to master node of Google Cloud Dataproc, but can ssh to Compute Engine VM

I am having no trouble sshing into a Google Cloud compute engine VM, but am unable to ssh into the master node of a Google Cloud Dataproc cluster.我在通过 ssh 连接到 Google Cloud 计算引擎 VM 时没有问题,但无法通过 ssh 连接到 Google Cloud Dataproc 集群的主节点。

Specifically,具体来说,

gcloud compute ssh my-vm

works just fine, while工作得很好,而

gcloud compute ssh mycluster-m

fails with error message:失败并显示错误消息:

admin@IP.ADDRESS: Permission denied (publickey).
ERROR: (gcloud.compute.ssh) [/usr/bin/ssh] exited with return code [255].

The compute engine VM and the Dataproc cluster are in the same project.计算引擎 VM 和 Dataproc 集群在同一个项目中。 I understand from the error message it is something related to the ssh keys, but I am not sure how to fix it - I checked the ssh keys in the project via cloud console, and it is correct, and tried the usual gcloud auth login to reset gcloud project login details.我从错误消息中了解到它与 ssh 密钥有关,但我不知道如何修复它 - 我通过云控制台检查了项目中的 ssh 密钥,它是正确的,并尝试了通常的gcloud auth login重置 gcloud 项目登录详细信息。

Any hints on how to fix this?有关如何解决此问题的任何提示?

Edits: I am trying to ssh from my machine, not the cloud console- that's a good point, I will try that and see if that is possible.编辑:我正在尝试从我的机​​器上 ssh,而不是云控制台 - 这是一个好点,我会尝试一下,看看是否可能。 But in the end I want to use this to connect to a Jupyter notebook from my local computer, so that does not solve the issue of being unable to SSH from my machine to the VM.但最后我想用它从我的本地计算机连接到 Jupyter notebook,这样并不能解决无法从我的机器 SSH 到 VM 的问题。

Concerning the command to create the Dataproc cluster, I use tools from the hail dataproc python library, but these are basically just convenience shells for the gcloud compute commands, and this is what is failing.关于创建 Dataproc 集群的命令,我使用来自hail dataproc python 库的工具,但这些基本上只是 gcloud compute 命令的便利 shell,这就是失败的原因。 But the command I used to create the Dataproc cluster was:但是我用来创建 Dataproc 集群的命令是:

gcloud beta dataproc clusters create \
    test \
    --image-version=1.4-debian9 \
    --properties=^|||^spark:spark.task.maxFailures=20|||spark:spark.driver.extraJavaOptions=-Xss4M|||spark:spark.executor.extraJavaOptions=-Xss4M|||spark:spark.speculation=true|||hdfs:dfs.replication=1|||dataproc:dataproc.logging.stackdriver.enable=false|||dataproc:dataproc.monitoring.stackdriver.enable=false|||spark:spark.driver.memory=41g \
    --initialization-actions=gs://hail-common/hailctl/dataproc/0.2.53/init_notebook.py \
    --metadata=^|||^WHEEL=gs://hail-common/hailctl/dataproc/0.2.53/hail-0.2.53-py3-none-any.whl|||PKGS=aiohttp>=3.6,<3.7|aiohttp_session>=2.7,<2.8|asyncinit>=0.2.4,<0.3|bokeh>1.1,<1.3|decorator<5|dill>=0.3.1.1,<0.4|gcsfs==0.2.1|humanize==1.0.0|hurry.filesize==0.9|nest_asyncio|numpy<2|pandas>0.24,<0.26|parsimonious<0.9|PyJWT|python-json-logger==0.1.11|requests>=2.21.0,<2.21.1|scipy>1.2,<1.4|tabulate==0.8.3|tqdm==4.42.1|google-cloud-storage==1.25.* \
    --master-machine-type=n1-highmem-8 \
    --master-boot-disk-size=100GB \
    --num-master-local-ssds=0 \
    --num-preemptible-workers=0 \
    --num-worker-local-ssds=0 \
    --num-workers=2 \
    --preemptible-worker-boot-disk-size=40GB \
    --worker-boot-disk-size=40GB \
    --worker-machine-type=n1-standard-8 \
    --initialization-action-timeout=20m \
    --labels=creator=my_name \
    --max-idle=10m

Turns out the problem is that the cluster creates a new account called my_username on the cluster master VM, but I am logged into my laptop as a user called 'admin'.原来问题是集群在集群主虚拟机上创建了一个名为 my_username 的新帐户,但我以名为“admin”的用户身份登录到我的笔记本电脑。 So there is a mismatch between account name and key at the destination, so the login fails.所以在目的地的账户名和密钥不匹配,所以登录失败。

Can be fixed by adding username to the gcloud command:可以通过向 gcloud 命令添加用户名来修复:

gcloud compute ssh my_username@mycluster-m

Though I still don't really understand why the ssh keys are different for the dataproc VM and a compute engine VM, I'd be happy if someone can enlighten me.虽然我仍然不太明白为什么 dataproc VM 和计算引擎 VM 的 ssh 密钥不同,但如果有人能启发我,我会很高兴。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM