温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

pssh 使用记录

发布时间:2020-05-04 18:15:00 来源:网络 阅读:378 作者:xingzhehxiang 栏目:系统运维

1、pssh 安装

yum -y install epel-release yum -y install pssh 安装完毕后有一下命令: pssh       ssh执行命令 pscp.pssh  copy到远程 pslurp     pull从远程 pnuke      kill远程进程 prsync     同步

2、ssh 免密配置

 yum -y install expect  ssh-keygen  -t rsa -f ~/.ssh/id_rsa -N "" -q    cat << EEE  >>/tmp/sshkey.sh  for ip in {192.168.56.13,192.168.56.14,192.168.56.15,192.168.56.16} do expect << EOF         spawn ssh-copy-id -i /root/.ssh/id_rsa.pub root@$ip         expect {                 "yes/no" { send "yes\n";exp_continue}                 "password" { send "123456\n"}         }         expect eof EOF done EEE /*那是一个描述符,告诉 shell ,管道符操作遇到这个东西就停下来。 EOF 只是一个通用的称呼,其实换成别的也是可以的。这看你文件里面的具体要求。*/

3、我常用的方式

3.1、远程yum 软件

 pssh -p 4  -h ip.txt  -i   "yum -y install screen"

3.2、远程kill 进程

pssh -p 2  -h ip.txt  -i   "sudo pkill -9 top"

3.3、拷贝文件到远程服务器

 pscp.pssh -h ip.txt ip.txt /tmp/ip.tmp

3.4、拉远程文件

[root@mgr ~]# pslurp -h ip.txt /tmp/ip.tmp  /rip.txt [1] 11:53:38 [SUCCESS] 192.168.56.15 [2] 11:53:38 [SUCCESS] 192.168.56.14 [3] 11:53:38 [SUCCESS] 192.168.56.13 [4] 11:53:38 [SUCCESS] 192.168.56.16 [root@mgr ~]# ls 192.168.56.1*/ 192.168.56.13/: rip.txt 192.168.56.14/: rip.txt 192.168.56.15/: rip.txt 192.168.56.16/: rip.txt [root@mgr ~]#

附录:

[root@mgr ~]# cat ip.txt  192.168.56.13 192.168.56.14 192.168.56.15 192.168.56.16 [root@mgr ~]#


向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI