./pdsh -R ssh -w node-10-0[0-5] hostname
-R:指定传输方式,默认为rsh,本例为ssh,如果希望ssh传输需要另行安装pdsh-rcmd-ssh,如果希望ssh无密码访问需要提前配置好。
-w:指定待执行命令host,也可以这样配置,node_[1-9, 35,22]
command:本例为hostname
sudo /etc/init.d/hadoop-0.20-namenode start
sudo /etc/init.d/hadoop-0.20-jobtracker start
/usr/bin/pdsh -R ssh -w CHN-DG-3-5I[3,4,8,9] "sudo /etc/init.d/hadoop-0.20-datanode start"
/usr/bin/pdsh -R ssh -w CHN-DG-3-5I[3,4,8,9] "sudo /etc/init.d/hadoop-0.20-tasktracker start"
模版:
/usr/bin/pdsh -R ssh -w node-10-0[0-5] 后面紧跟命令即可
/usr/bin/pdsh -R ssh -w node-10-0[0-5]
原文地址:http://www.cnblogs.com/liangliangdetianxia/p/3835863.html