SSH stands for secure shell. It is an encrypted remote login protocol. Once it has been set up on each node, it can be used to communicate with various other nodes in that network.
The main benefits of SSH are:
- SSH uses the RSA encryption algorithm to generate public and private keys, making intrusion extremely difficult.
- Since SSH is a remote login protocol, it can be configured on a laptop. That means you can use your laptop to wirelessly connect to the raspberry pi cluster.
- Because protocols like SCP (Secure Copy) and SFTP (Secure File Transfer Protocol) run on top of SSH, you can use them to transfer files and folders directly from one node to another.
- SSH supports one time log in. This means that you only have to enter credentials the first time you log in. From the second log in onwards, it’s not necessary.
To log in to any other node from the master node use the command:
ssh [email protected]
(change the IP address to represent your IP address) .
This will ask for a password. Once you log in, all the commands you type will run on that node and not on the master.
SSH can also be used to run commands directly on the other nodes. For example, to change the hostname of different nodes, use this command:
ssh [email protected] ‘sudo echo “cilent001″ | sudo nano /etc/hostname
ssh [email protected] ‘sudo echo “cilent002″ | sudo nano /etc/hostname
ssh [email protected] ‘sudo echo “cilent003″ | sudo nano /etc/hostname …and so on.
This way SSH can be used to run commands on other nodes from the master node as:
ssh [email protected] ‘sudo poweroff’
This command safely shuts down the node with IP address 192.168.3.216.
The following figure shows how SSH is used to log in to a worker node (192.168.3.216) and from the worker node, get the control terminal back to the master node.
As you can see in the above figure, logging in to a worker node happens directly. But each time the control of the terminal comes back to the master node (192.168.3.215), the login credential has to be entered.
So after issuing commands via SSH to other nodes, there might be situations where data has to be sent to multiple nodes. If the number of nodes are small, then we can manually log in to each node, connect it to a display and keyboard, and send files. But this is a highly inefficient way to do it when the size of the cluster is large.
An easier way would be to use SCP to send files. Install SCP using the command:
sudo apt-get install scp
Read my full post on HowToforge : here