pdsh配置及应用

1、下载和安装

可以在官网http://sourceforge.net/projects/pdsh/下载。

wget http://nchc.dl.sourceforge.net/project/pdsh/pdsh/pdsh-2.26/pdsh-2.26.tar.bz2
tar jxvf pdsh-2.26.tar.bz2
cd pdsh-2.26
./configure
make
make install

2、安装好以后,可以先看下pdsh的参数

hadoop@master:~/pdsh-2.26$ pdsh --help
pdsh: invalid option -- '-'
Usage: pdsh [-options] command ...
-S                return largest of remote command return values
-h                output usage menu and quit
-V                output version information and quit
-q                list the option settings and quit
-b                disable ^C status feature (batch mode)
-d                enable extra debug information from ^C status
-l user           execute remote commands as user
-t seconds        set connect timeout (default is 10 sec)
-u seconds        set command timeout (no default)
-f n              use fanout of n nodes
-w host,host,...  set target node list on command line
-x host,host,...  set node exclusion list on command line
-R name           set rcmd module to name
-M name,...       select one or more misc modules to initialize first
-N                disable hostname: labels on output lines
-L                list info on all loaded modules and exit
available rcmd modules: rsh,exec (default: rsh)
3、远程执行命令

hadoop@master:~/pdsh-2.26$ pdsh -d -R exec -w hadoop@slave[1-4] ssh -x %h "hostname"
slave3: slave3
slave2: slave2
slave1: slave1
slave4: slave4
Connect time:  Avg: 0 sec, Min: 0 sec,  Max: 0 sec
Command time:  Avg: 1 sec, Min: 1 sec,  Max: 1 sec
Failures:      0
需要执行其他命令的时候,只需要把引号里面的换成其他命令就行了。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值