Wednesday, November 20, 2013

How to install something on multiple machines at once with pssh (parallel ssh)

It is a common practice to need to install and configure something on multiple machines at once. While there are a number of tools to do this, a quick and dirty way to do this is with parallel ssh. i had a bit of a hard time setting this up the first time, so are my notes on how to configure this correctly. This was tested on Ubuntu but may work on other platforms as well. First, install parallel-ssh .
sudo aptitude install pssh
Then you will need to grant passwordless authentication to the remote machines for pssh to work. First, we have to generate an SSH key:œœ
ssh-keygen -t rsa -P ""
The second line will create an RSA key pair with an empty password. Generally, using an empty password is not recommended, but in this case it is needed to unlock the key without your interaction (you don’t want to enter the passphrase every time Hadoop interacts with its nodes). Second, you have to enable SSH access to your local machine with this newly created key. cat $HOME/.ssh/id_rsa.pub >> $HOME/.ssh/authorized_keys Third, distribute the public key to the other machines:
ssh-copy-id -i $HOME/.ssh/id_rsa.pub root@machine2 ssh-copy-id -i $HOME/.ssh/id_rsa.pub root@machine3
and you are done. pssh is now renamed parallel-ssh. Let's give it a try:
root@tabitha7:~# parallel-ssh -h ./cassandrahosts -i ls [1] 11:23:32 [SUCCESS] x.x.x.71 tomcat [2] 11:23:32 [SUCCESS] x.x.x.74 jdk-6u45-linux-x64.bin

0 comments:

Post a Comment

Note: Only a member of this blog may post a comment.