pdsh安装

下载搜索https://sourceforge.net/projects/pdsh/

下载后放入linux目录,一次进行如下操作:

1、tar -jxvf pdsh-2.26.tar.bz2 -C /tmp

2、cd /tmp/pdsh-2.26/

3、./configure \
--prefix=/opt/server/pdsh/pdsh/2.26/ \
--with-timeout=60 \
--with-ssh \
--with-rcmd-rank-list=ssh
--with-machines=/opt/server/pdsh/machines \

选项 解释
--prefix 指定安装目录
--with-timeout=60 指定pdsh默认执行超时时间
--with-ssh 编译ssh模块
--with-exec 编译exec模块
--with-nodeupdown 编译节点宕机功能
--with-readline 编译readline功能
--with-rcmd-rank-list 指定默认模式为ssh
--with-machines 指定默认主机列表

如果报错:
configure: error: Cannot find libreadline!
执行命令:yum -y install readline-devel

在上过过程中,已经通过--with-machines,指定可以使用/usr/local/globle/softs/tools/pdsh/2.26/machines来定义默认的主机列表
内容如下:

node1
node2
node3
node4
node5

4、make

5、make install

6、cd /opt/server/pdsh/bin

7、pdsh -V

 语法介绍

-w 【 指定远程主机】,可以指定多个,每个主机用逗号隔开,host可以是主机名也可以是IP地址。

[root@server ~]# pdsh -w ssh:user001,ssh:user002,ssh:user003 "date"
[root@server ~]#pdsh -w ssh:user0[10-31],/1$/ "uptime"

此命令在选择远程主机时使用了正则表达式,表示在user010到user031中选择以1结尾的主机名,即在user011、user021、user031上执行uptime命令

-x 此参数用来排除某些或某个主机,例如:

[root@server ~]#pdsh -R ssh -l opsuser -w user00[1-9] -x user005,user007 "date"

-V 此参数可以查看软件的版本信息以及可用的模块信息

 

 

 

 

posted @ 2020-05-27 20:28  鱼丸河粉  阅读(740)  评论(0编辑  收藏  举报