...
Code Block |
---|
: mycluster-minion-0 mycluster-minion-1 |
Executing custom commands in multiple VM nodes
Because the created cluster has prepared environments allowing ssh access to all VM nodes for root account in a key-based login mode without password, the following script works via ssh remote execution in all remote VM nodes.
Code Block | ||
---|---|---|
| ||
#!/bin/bash
RUNCMD='cd /tmp; /mnt/mpi/cloud_ex/tool_install_and_setup_conda_in_local_volume.sh'
CLUSTERNAME="mycluster"
MINIONLASTIND="2"
echo "... install on ${CLUSTERNAME}-master"
echo $RUNCMD | bash
for ind in $(seq 0 ${MINIONLASTIND})
do
echo "... install on ${CLUSTERNAME}-minion-${ind}"
ssh ${CLUSTERNAME}-minion-${ind} "${RUNCMD}"
done |
This script is available at https://github.com/astromsshin/cloud_ex/blob/main/tool_execute_commands_all_nodes.sh . The script shows a typical case of executing custom commands in all VM nodes including a master node in the cluster. Other scripts in this tip section basically follow the same way as the above script in executing specific commands. If you are not familiar with executing multiple Linux shell commands in a single command-line, see https://dev.to/0xbf/run-multiple-commands-in-one-line-with-and-linux-tips-5hgm .
Changing root password in multiple VM nodes
...