自动化运维工具-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为主 ...
随机推荐
- loadrunner上传文件到网盘
有人提问,loadrunner 上传文件搞不好,请求帮忙处理.让提供网址,用fiddler抓包上传部分,主要有3个请求 第一个请求GET https://yun.xxx.com/api/files/u ...
- [转]Unity手游之路<十二>手游资源热更新策略探讨
最近梳理了下游戏流程.恩,本来想写下,但是,还是看前辈的吧 版权声明: https://blog.csdn.net/janeky/article/details/17666409 上一次我们学习了如何 ...
- Python3自定义json逐层解析器
[本文出自天外归云的博客园] 用python3对json内容逐层进行解析,拿中国天气网的接口返回数据测试,代码如下: # -*- coding: utf-8 -*- import operator a ...
- 【iCore1S 双核心板_ARM】例程九:DAC实验——输出直流电压
实验原理: STM32内部集成12位DAC,可以配置成12位或8位,DAC具有两个独立转换通道, 在双DAC模式下,DA转换可被配置成独立模式或工作模式,iCore1S中DAC参考电压为 2.5V.本 ...
- File 类的 getCanonicalFile( ) 和 getAbsoluteFile( ) 区别
一.打开java.io.File源码,看下两个方法的区别 getAbsoluteFile public File getAbsoluteFile() { String absPath = getAbs ...
- java-信息安全(十七)-*.PFX(*.p12)&个人信息交换文件
原文地址 http://snowolf.iteye.com/blog/735294 与计费系统打交道,少不了用到加密/解密实现.为了安全起见,通过非对称加密交换对称加密密钥更是不可或缺.那么需要通过什 ...
- Provided id of the wrong type for class pojo.Books. Expected: class java.lang.Integer, got class java.lang.Long
log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment). log4j:WARN Please ...
- adb shell dumpsys 命令
Android开发中,常常可以用adb shell dumpsys这条命令来dump出系统运行时的状态信息,例如可以这样来察看某个应用的内存使用信息 adb shell dumpsys meminfo ...
- [Model] AlexNet
CaffeNet - a variant of AlexNet Ref: Classification: Instant Recognition with Caffe This is caffeNet ...
- Mybatis常见面试题(转)
Mybatis技术内幕系列博客,从原理和源码角度,介绍了其内部实现细节,无论是写的好与不好,我确实是用心写了,由于并不是介绍如何使用Mybatis的文章,所以,一些参数使用细节略掉了,我们的目标是介绍 ...