自动化运维工具-pdsh工具安装配置及简单使用讲解
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工具安装配置及简单使用讲解的更多相关文章
- saltstack自动化运维系列⑥SaltStack实践安装配置HAproxy的Keepalived
saltstack自动化运维系列⑥SaltStack实践安装配置HAproxy的Keepalived 安装配置Keepalived 1.编写功能模块 #创建keepalived目录# mkdir -p ...
- saltstack自动化运维系列⑥SaltStack实践安装配置HAproxy
saltstack自动化运维系列⑥SaltStack实践安装配置HAproxy 下载haproxy1.6.2.tar.gz下载地址:http://www.haproxy.org/download/1. ...
- 自动化运维工具-mussh工具安装配置及简单使用讲解
1.先决条件: 安装pssh工具的主机针对远程主机需要配置免秘钥认证: ssh-keygen -t rsa ssh-copy-id [remotehost] 2.下载mussh工具安装介质: http ...
- 自动化运维工具-pssh工具安装配置及简单使用讲解
1.先决条件:安装pssh工具要求python版本大于2.4即可. 安装pssh工具的主机针对远程主机需要配置免秘钥认证: ssh-keygen -t rsa ssh-copy-id [remoteh ...
- saltstack自动化运维系列12配置管理安装redis-3.2.8
一.准备redis自动化配置的文件(即安装一遍redis,然后获取相关文件和配置在salt中执行上线) 1.源码安装redis3.2.8并注册为系统服务 安装依赖yum install -y tcl ...
- Chef 自动化运维:Chef 的安装
安装准备 准备三台服务器,分别用作 Chef Server.Chef DK.Chef Client 的安装使用. 在三台服务器中,添加以下 hosts: vim /etc/hosts 192.168. ...
- python自动化运维-编写rsync+sersync安装脚本实现文件实时同步
rsync+sersync组合可以实时监听目录的变化,实现实时同步数据. 具体安装教程可查看:http://www.osyunwei.com/archives/7447.html. 安装着实有些复杂, ...
- 自动化运维:(3)写一个简单的Shell脚本(案例)
一.需求 1.test.sh 脚本执行时候需要添加参数才能执行 参数和功能详情如下: 参数 执行效果 start 启动中... stop 关闭中... restart 重启中... * 脚本帮助信息. ...
- 自动化运维工具fabric使用教程
摘要:当需要同时管理许多服务器时,如果我们一台一台登陆上去操作会显得费时又费力.此时我们可以用fabric这个包提供的API来编写python脚本完成服务器集群的统一管理. 核心原理:fabric为主 ...
随机推荐
- 剖析 Linux hypervisor
hypervisor 之于操作系统类似于操作系统之于进程.它们为执行提供独立的虚拟硬件平台,而虚拟硬件平台反过来又提供对底层机器的虚拟的完整访问.但并不是所有 hypervisor 都是一样的,这是件 ...
- 深入理解C++中public、protected及private用法
深入理解C++中public.protected及private用法 这篇文章主要介绍了C++中public.protected及private用法,对于C++面向对象程序设计来说是非常重要的概念 ...
- 透彻理解Spring事务设计思想之手写实现
前言 事务,是描述一组操作的抽象,比如对数据库的一组操作,要么全部成功,要么全部失败.事务具有4个特性:Atomicity(原子性),Consistency(一致性),Isolation(隔离性),D ...
- linux每日命令(18):whereis命令
whereis命令用于查找文件. 该指令会在特定目录中查找符合条件的文件.这些文件应属于原始代码.二进制文件,或是帮助文件. 该指令只能用于查找二进制文件.源代码文件和man手册页,一般文件的定位需使 ...
- DIOCP-V5发布
DIOCP-v5开源项目 https://github.com/ymofen/diocp-v5 DIOCP-v5 0.0.1 2015-02-22 08:40:40 1.规范单元文件的命名,和 ...
- PHP可变参数
0x00 缘起 在laravel的源码里经常可以看到下面的函数形式 $func(...$args) 0x01 可变参数旧写法 这表示$func支持可变参数,在php5.6之前则是在函数体内调用 fun ...
- sql1032n sql6048n db2start启动不了 db2修改hostname
今天下午把虚拟机上的linux的hostanme改掉了 结果启动DB2的时候发生了这样的错误 SQL6048N A communication error occurred during START ...
- 关于CLOS架构的举例 网络级 设备级 FATTREE网络 网络级CLOS 以及CLOS涉及的调度算法RR
1.概述 CLOS来自于传统电路交换概念,这个概念年代太久远,在当前数据通信网络中,内涵有所变化.本文主要谈的是实际上赋予的与原来略微有所差异的内涵. CLOS架构本身概念比较宽泛,有设备级的CLOS ...
- 驱动文件中只有cat/inf/dll文件,怎么安装
网上下载了一个驱动,里面包含文件只有cat/inf/dll文件,怎么安装? 1.计算机-右键-管理-设备管理器,找到要装驱动的设备上 2.右键-更新驱动程序-浏览到本地的这个驱动文件夹 3.开始安装
- Python爬虫学习——使用selenium和phantomjs爬取js动态加载的网页
1.安装selenium pip install selenium Collecting selenium Downloading selenium-3.4.1-py2.py3-none-any.wh ...