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

网友投稿 403 2022-11-23

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

1、先决条件:安装pssh工具的主机针对远程主机需要配置免秘钥认证:ssh-keygen -t rsassh-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.bz2cd 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 --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 exit-g groupname      target hosts in dsh group "groupname"-X groupname      exclude hosts in dsh group "groupname"-a                target all nodesavailable 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 db01db02db03db04$ pdsh -R ssh -a "uptime" cat /etc/dsh/group/bdgroup db01db02db03db04pdsh -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 db02pdsh> ls -ldb02: total 139040db02: drwxr-xr-x 8 hadoop hadoop       233 Jul 26  2014 jdk1.7.0_67db02: -rwxrwxr-x 1 hadoop hadoop 142376665 Oct  2 07:51 jdk-7u67-linux-x64.tar.gzpdsh> pwddb02: /home/hadooppdsh> rm -rf jdk1.7.0_67pdsh> ls -ldb02: total 139040db02: -rwxrwxr-x 1 hadoop hadoop 142376665 Oct  2 07:51 jdk-7u67-linux-x64.tar.gzpdsh> sudo tar -zxf jdk-7u67-linux-x64.tar.gz -C /mnt/pdsh> ls -l /mntdb02: total 9424db02: drwxr-xr-x  8     10    143     233 Jul 26  2014 jdk1.7.0_67pdsh> quit 2)pdcp使用案例: 使用pdcp命令要求本地主机和远程主机必须安装pdsh工具,这也是唯一一点麻烦的地方。 pdcp -R ssh -w db02 /mnt/pssh-2.3.1.tar.gz /home/hadoop/

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:自动化运维工具-pssh工具安装配置及简单使用讲解
下一篇:java并发请求下数据插入重复问题的解决方法
相关文章

 发表评论

暂时没有评论,来抢沙发吧~