Installing NFS folder on nodes using a single command or shell

I am developing a parallel system (Bewoulf cluster) with 10 nodes. After starting the NFS server, I ssh to each node and then mount the NFS folder separately on each node using the following command

$ sudo mount 192.168.1.100:~/mpi  ~/mpi

      

ssh for each node and command execution, takes a little time

Is there any other way to run a single command or shell script; so what is the "mount command" that will automatically run on every node and mount the shared folder?

+3


source to share


2 answers


A very simple approach is to use ssh for each node.

for host in $(cat hosts); do
  ssh control@$host sudo mount 192.168.1.100:~/mpi  ~/mpi
done

      



You can generate a key without password and protect clients by typing the command in authorized_keys file

command="sudo mount 192.168.1.100:~/mpi  ~/mpi",no-port-forwarding,no-agent-forwarding,no-X11-forwarding,no-pty ssh-rsa ....

      

0


source


You should use something like pdsh and generate passwordless keys to access compute nodes. After deploying the keys, you can connect all nodes with just one command:

pdsh -w ^hosts_file sudo mount 192.168.1.100:~/mpi  ~/mpi

      



You can find more examples of using pdsh on the pdsh wiki

0


source







All Articles