Hi all,
To whoever wants to run a command on all cluster nodes, here is a way...
On one node create the file /bin/cssh with the following content:
and make it executable with chmod +x /bin/cssh.
Now you should be able to run a command sequentially on all cluster nodes like
Copy cssh to all other cluster nodes with cssh scp nodeX:/bin/cssh /bin/.
During this process try to eliminate all time consuming authorization questions or key mismatches:
If you get prompted for password when scp'ing to node7, for instance, run ssh-copy-id node7.
If you get a key/fingerprint mismatche that you can explain, note the offending key file and number and then remove the key with something like sed -i 3d .ssh/known_hosts
Questions or improvements are more than welcome.
To whoever wants to run a command on all cluster nodes, here is a way...
On one node create the file /bin/cssh with the following content:
Code:
#!/bin/bash
if [ ! -n "$1" ]; then echo "Usage: $0 [command]"; else
for n in `xmllint --xpath //clusternode/@name /etc/pve/cluster.conf | sed 's/name="\|"//g'`; do
echo --- $n -----------------------------------------------------
ssh -T $n "$@"
done
fi
Now you should be able to run a command sequentially on all cluster nodes like
cssh "pveversion -v | grep kernel"
or
cssh df -h | egrep "(pve-|---)".
or
cssh df -h | egrep "(pve-|---)".
Copy cssh to all other cluster nodes with cssh scp nodeX:/bin/cssh /bin/.
During this process try to eliminate all time consuming authorization questions or key mismatches:
If you get prompted for password when scp'ing to node7, for instance, run ssh-copy-id node7.
If you get a key/fingerprint mismatche that you can explain, note the offending key file and number and then remove the key with something like sed -i 3d .ssh/known_hosts
Questions or improvements are more than welcome.