pdsh配置及应用

来源:互联网 发布:python 人工神经网络 编辑:程序博客网 时间:2024/05/14 17:51

1、下载和安装

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

wget http://nchc.dl.sourceforge.net/project/pdsh/pdsh/pdsh-2.26/pdsh-2.26.tar.bz2tar jxvf pdsh-2.26.tar.bz2cd pdsh-2.26./configuremakemake install

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

hadoop@master:~/pdsh-2.26$ pdsh --helppdsh: 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 exitavailable 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: slave3slave2: slave2slave1: slave1slave4: slave4Connect time:  Avg: 0 sec, Min: 0 sec,  Max: 0 secCommand time:  Avg: 1 sec, Min: 1 sec,  Max: 1 secFailures:      0
需要执行其他命令的时候,只需要把引号里面的换成其他命令就行了。