Wednesday, October 18, 2017

pdsh? hell yes please and thank you!

So this dude I know +jay vyas, he's constantly telling me about new linux shit I have to try.  Recently he's been talking about pdsh, a multithreaded remote shell client that executes commands on multiple remote hosts, in parallel.  DaFuk, have I been living under a rock?!

Today I'm adding NFS storage to my OpenShift cluster in AWS.  After setting up my EBS I needed to create a directory and then mount that shit on 4 OPenShift nodes.  While I could have just ssh into each one, using TMUX of course, and run the pdsh command to mount the EBS share, I couldn't resist busting a nut with pdsh.
So I create a text file with all the servers I want to push commands to in /var/tmp, called oseServers.txt and get to work:

First let me create the mount point on all the Nodes:

[root@ip-172-31-35-71 tmp]# pdsh -R ssh -w ^oseServers.txt sudo mkdir /mnt/efs 

Now let me mount that AWS EFS
[root@ip-172-31-35-71 tmp]# pdsh -R ssh -w ^oseServers.txt sudo mount -t nfs4 -o nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2 fs-<hidden-from-your-eyes...>.efs.us-east-2.amazonaws.com:/ /mnt/efs 

I don't believe that shit really mounted anything on the nodes...
So I ssh into one of the nodes and check:

[root@ip-172-31-47-57 ~]# df -h /mnt/efs/
Filesystem                                 Size  Used Avail Use% Mounted on
fs-8854bef1.efs.us-east-2.amazonaws.com:/  8.0E     0  8.0E   0% /mnt/efs

[root@ip-172-31-47-57 ~]# 

Awww yea!  pdsh is the shit!









As always, what I blog about are my views and opinions and only mine, and are never the views or opinions of my past | present | future employers.

No comments:

Post a Comment