1、先决条件:
安装pssh工具的主机针对远程主机需要配置免秘钥认证:
ssh-keygen -t rsa
ssh-copy-id [remotehost]
2、下载mussh工具安装介质:
https://jaist.dl.sourceforge.net/project/mussh/mussh/1.0/mussh-1.0.tgz
3、安装mussh
mussh安装非常简单,直接解压缩安装包即可使用。
tar -zxvf mussh-1.0.tgz -C /usr/local/
执行/usr/local/mussh/mussh --help可以查看mussh命令帮助。
4、mussh使用案例
/usr/local/mussh/mussh -h db01 db02 -c uptime
$ cat machines
db01
db02
db03
db04
$ /usr/local/mussh/mussh -H machines -c uptime
db01: 01:10:38 up 1 day, 21:17, 2 users, load average: 0.00, 0.01, 0.05
db02: 01:10:38 up 1 day, 21:16, 1 user, load average: 0.00, 0.01, 0.05
db03: 01:10:39 up 1 day, 21:16, 1 user, load average: 0.01, 0.02, 0.05
db04: 01:10:39 up 1 day, 21:16, 0 users, load average: 0.00, 0.01, 0.05
$ cat uptime.sh
uptime
$ /usr/local/mussh/mussh -H machines -l hadoop -o "port=22" -s /usr/bin/bash -C uptime.sh
hadoop@db01: 01:14:00 up 1 day, 21:20, 2 users, load average: 0.13, 0.04, 0.05
hadoop@db02: 01:14:00 up 1 day, 21:20, 1 user, load average: 0.01, 0.02, 0.05
hadoop@db03: 01:14:00 up 1 day, 21:19, 1 user, load average: 0.00, 0.01, 0.05
hadoop@db04: 01:14:00 up 1 day, 21:19, 0 users, load average: 0.00, 0.01, 0.05