One of the most important parts of a working cluster is the interconnection and communication between nodes. While the networking side will not be covered now, a very important aspect will be: passwordless SSH.
Inter-node SSH
The first task to getting easy access between nodes is ensuring SSH access between all the nodes.
While not necessary, I recommend adding all your nodes to the /etc/hosts
file on each node. For example, the /etc/hosts
file might look like
|
|
to which I would add (using the actual IPs of the nodes)
|
|
After this is added to your hosts file on all your nodes, from any node you should be able to ssh node1
from any of them successfully after entering your password.
Passwordless SSH
To be able to SSH between nodes without the need for a password, you will need to create an SSH key. This will allow SSH to work in scripts and tools (MPI) without needing user interaction.
First, we need to create a key. There are multiple standards of encryption you can use for SSH keys. The default is RSA, but it is generally considered to be less secure than modern standards. Therefore, these instructions will show how to create a ed25519 key. This will work on your cluster, but some (very) old systems may not support ED25519 keys (RSA keys will generally work everywhere even though they are less secure).
To create a key, use this command on one of your nodes:
|
|
This article does a good job of breaking down what all the arguments are used for.
Next, we need our nodes to trust the key we just created. We’ll start with getting the current node to trust the key.
|
|
Now we can just copy these files to all the other nodes so that they can use and will trust this key.
|
|
And to make all the nodes trust each other’s fingerprints
|
|
We can check that we can SSH into all the nodes without having to enter a password:
|
|