Specify ssh port to cluster YAMLs

Can I specify the ssh port for each node in local cluster case?

For example:

provider:
    type: local
    head_ip: "<head_hostname>:<port>"
    worker_ips: ["<worker_hostname_1>:<port>", "<worker_hostname_2>:<port>"]

cc @thomasdesr Can address this question?

Hi @manos , No you cannot do that. I don’t understand why do you need to specify a port. The local cluster means that you have say 10 nodes, each has its own IP, so what the port means here?

Hey @manos !

Are you trying to specify different ports per host or just a single port for all hosts?

As Ameer mentioned I don’t think you can set that because those fields are used for more than just configuring SSH.

One workaround you could try here is specifying the host -> port mapping in your ssh_config at ~/.ssh/config. E.g.

Host head_hostname
    Port 12345

Host worker_hostname_*
    Port 54321

Thank you all for the quick response!

Indeed, the ideal workaround will be the ssh_config. All nodes are added to ssh_config but it doesn’t work. If I try manually to ssh my server, it works. I get the following error:

<1/1> Setting up head node
  Prepared bootstrap config
2021-01-22 11:35:16,799 INFO node_provider.py:93 -- ClusterState: Writing cluster state: ['head_node']
  New status: waiting-for-ssh
  [1/7] Waiting for SSH to become available
    Running `uptime` as a test.
    SSH still not available ([Errno -2] Name or service not known), retrying in 5 seconds.

Should I specify the ssh_config? Is there any way to increase verbose messages?

Thank you in advance

1 Like

It’s 2025, I don’t know whether this has been solved, I meet the same problem. @thomasdesr

The problem is, when you specify ip in the yaml config, it will use default port 22 to ssh worker ips. When you specify name in the config, ray will view it as a hostname needed to parse, while that might be only configured in the ssh config, not the global dns config.