On GCE, I have 3 VMs and I can use
ssh to access them from one of them.
I've installed Cassandra on them and configured
PATH environment variable in
PATH=$PATH:$HOME/.local/bin:$HOME/bin export CASSANDRA_HOME=/opt/apache-cassandra-3.11.1 export SPARK_HOME=/opt/spark-2.1.2-bin-hadoop2.7 PATH=$PATH:$CASSANDRA_HOME/bin:$SPARK_HOME/bin:$SPARK_HOME/sbin export PATH
echo $PATH and getting
/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/nmj/.local/bin:/home/nmj/bin:/opt/apache-cassandra-3.11.1/bin:/opt/spark-2.1.2-bin-hadoop2.7/bin:/opt/spark-2.1.2-bin-hadoop2.7/sbin means it's correct.
But when running
pssh -h hosts.txt -l nmj -i 'echo $PATH', I only got
$PATH looks incorrect here.
So I couldn't use
pssh to execute ssh in parallel to start up
pssh -h hosts.txt -l nmj -i cassandra, because of
bash: cassandra: command not found.
How to configure
In my opinion,
pssh will start a non-login shell. So it'll not load
~/.bash_profile file. Then when I defined these variables in
~/.bashrc file, it worked.