1、先决条件:

安装pssh工具的主机针对远程主机需要配置免秘钥认证:

ssh-keygen -t rsa

ssh-copy-id [remotehost]

2、下载pssh工具安装介质:

https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/pdsh/pdsh-2.29.tar.bz2

3、安装pdsh:

tar -jxvf pdsh-2.29.tar.bz2

cd pdsh-2.29

./configure --with-ssh --with-rsh --with-mrsh --with-mqshell \

--with-dshgroups --with-machines=/etc/pdsh/machines

make && make install

安装成功后OS会多出pdsh和pdcp两个命令:

3、pdsh工具使用详解:

查看帮助:

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

-g groupname      target hosts in dsh group "groupname"

-X groupname      exclude hosts in dsh group "groupname"

-a                target all nodes

available rcmd modules: ssh,rsh,exec (default: rsh)

1)pdsh使用案例:

pdsh -w ssh:192.168.0.18[1-4] "uname -n"

pdsh -w ssh:192.168.0.18[1-4] -x db01 "uptime"

pdsh -w ssh:192.168.0.18[1-4],/[234]$/ "uptime"

$ cat /etc/pdsh/machines

db01

db02

db03

db04

$ pdsh -R ssh -a "uptime"

cat /etc/dsh/group/bdgroup

db01

db02

db03

db04

pdsh -R ssh -g bdgroup "uptime"

pdsh -R ssh -a -X bdgroup uptime

pdsh -R ssh -a "sudo touch /mnt/aaa"

pdsh交互式命令窗口:

$ pdsh -R ssh -w db02

pdsh> ls -l

db02: total 139040

db02: drwxr-xr-x 8 hadoop hadoop       233 Jul 26  2014 jdk1.7.0_67

db02: -rwxrwxr-x 1 hadoop hadoop 142376665 Oct  2 07:51 jdk-7u67-linux-x64.tar.gz

pdsh> pwd

db02: /home/hadoop

pdsh> rm -rf jdk1.7.0_67

pdsh> ls -l

db02: total 139040

db02: -rwxrwxr-x 1 hadoop hadoop 142376665 Oct  2 07:51 jdk-7u67-linux-x64.tar.gz

pdsh> sudo tar -zxf jdk-7u67-linux-x64.tar.gz -C /mnt/

pdsh> ls -l /mnt

db02: total 9424

db02: drwxr-xr-x  8     10    143     233 Jul 26  2014 jdk1.7.0_67

pdsh> quit

2)pdcp使用案例:

使用pdcp命令要求本地主机和远程主机必须安装pdsh工具,这也是唯一一点麻烦的地方。

pdcp -R ssh -w db02 /mnt/pssh-2.3.1.tar.gz /home/hadoop/

自动化运维工具-pdsh工具安装配置及简单使用讲解的更多相关文章

  1. saltstack自动化运维系列⑥SaltStack实践安装配置HAproxy的Keepalived

    saltstack自动化运维系列⑥SaltStack实践安装配置HAproxy的Keepalived 安装配置Keepalived 1.编写功能模块 #创建keepalived目录# mkdir -p ...

  2. saltstack自动化运维系列⑥SaltStack实践安装配置HAproxy

    saltstack自动化运维系列⑥SaltStack实践安装配置HAproxy 下载haproxy1.6.2.tar.gz下载地址:http://www.haproxy.org/download/1. ...

  3. 自动化运维工具-mussh工具安装配置及简单使用讲解

    1.先决条件: 安装pssh工具的主机针对远程主机需要配置免秘钥认证: ssh-keygen -t rsa ssh-copy-id [remotehost] 2.下载mussh工具安装介质: http ...

  4. 自动化运维工具-pssh工具安装配置及简单使用讲解

    1.先决条件:安装pssh工具要求python版本大于2.4即可. 安装pssh工具的主机针对远程主机需要配置免秘钥认证: ssh-keygen -t rsa ssh-copy-id [remoteh ...

  5. saltstack自动化运维系列12配置管理安装redis-3.2.8

    一.准备redis自动化配置的文件(即安装一遍redis,然后获取相关文件和配置在salt中执行上线) 1.源码安装redis3.2.8并注册为系统服务 安装依赖yum install -y tcl ...

  6. Chef 自动化运维:Chef 的安装

    安装准备 准备三台服务器,分别用作 Chef Server.Chef DK.Chef Client 的安装使用. 在三台服务器中,添加以下 hosts: vim /etc/hosts 192.168. ...

  7. python自动化运维-编写rsync+sersync安装脚本实现文件实时同步

    rsync+sersync组合可以实时监听目录的变化,实现实时同步数据. 具体安装教程可查看:http://www.osyunwei.com/archives/7447.html. 安装着实有些复杂, ...

  8. 自动化运维:(3)写一个简单的Shell脚本(案例)

    一.需求 1.test.sh 脚本执行时候需要添加参数才能执行 参数和功能详情如下: 参数 执行效果 start 启动中... stop 关闭中... restart 重启中... * 脚本帮助信息. ...

  9. 自动化运维工具fabric使用教程

    摘要:当需要同时管理许多服务器时,如果我们一台一台登陆上去操作会显得费时又费力.此时我们可以用fabric这个包提供的API来编写python脚本完成服务器集群的统一管理. 核心原理:fabric为主 ...

随机推荐

  1. 如何永久删除git仓库中敏感文件的提交记录

    如何永久删除git仓库中敏感文件的提交记录 参考: 1. https://help.github.com/articles/remove-sensitive-data/

  2. 跟我学SharePoint2013视频培训课程——版本控制示例(15)

    课程简介 第15天,SharePoint 2013版本控制示例 视频 SharePoint 2013 交流群 41032413

  3. 阿里云 ssh 登陆请使用(公)ip

    一直以为要要登陆使用的是私有的ip,最后才发现是使用共有ip, 如图 47.52.69.151 > ssh root@47.52.69.151 > 输入密码

  4. python ddt 传多个参数值示例

    import unittest from ddt import ddt,data,file_data,unpack @ddt class TestDDT(unittest.TestCase): lis ...

  5. 如何保留自己对eclipse的个性化设置,在其他工程中使用

    有的个性化设置是在功能的.metadata\.plugins文件夹下保存.所以新建功能后,个性化设置都没有了. 解决办法: 新建一个工程后,调好个性化配置.然后备份整个工程. 以后不要新建工程,直接解 ...

  6. 第三部分:Android 应用程序接口指南---第二节:UI---第三章 菜单

    第3章 菜单 在许多不同类型的应用中,菜单通常是一种用户界面组件.为了提供给用户提供熟悉且一致的体验,你需要使用菜单API来展示用户动作和你Activity中的其他选项. 从安卓3.0系统(API l ...

  7. 使用ffmpeg 推流

    1.编译ffmpeg http://www.linuxidc.com/Linux/2014-11/109840.htm http://www.linuxidc.com/Linux/2013-02/78 ...

  8. 【Linux高级驱动】rtc驱动开发

    [1.分层思想] 1.1 rtc-dev.c   //设备接口层,功能:给用户提供接口 subsys_initcall(rtc_init);   , RTC_DEV_MAX, "rtc&qu ...

  9. tail -f 实时查看日志文件 linux查看日志后100行

    tail -f 实时查看日志文件 tail -f 日志文件logtail - 100f 实时查看日志文件 后一百行tail -f -n 100 catalina.out linux查看日志后100行搜 ...

  10. 跨控制器跳转view——RedirectToRoute和RedirectToAction

    已知控制器AccountController.cs和HomeController.cs,如果从页面Account/Login直接跳转到Home/Index,可以利用RedirectToRoute和Re ...