Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to deploy pssh in Centos7

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces the relevant knowledge of "how to deploy pssh in Centos7". The editor shows you the operation process through an actual case. The operation method is simple, fast and practical. I hope this article "how to deploy pssh in Centos7" can help you solve the problem.

Pssh is a tool written by python that can execute commands concurrently on multiple machines. Its usage is comparable to some simple uses of ansible, and it is faster than ansible. It supports parallel file replication, remote command execution, killing processes on remote hosts, and so on.

Download pssh installation package [root@localhost ~] # wget https://files.pythonhosted.org/packages/60/9a/8035af3a7d3d1617ae2c7c174efa4f154e5bf9c24b36b623413b38be8e4a/pssh-2.3.1.tar.gz installation dependency package [root@localhost ~] # yum install-y make gcc gcc++ python-devel python-pip installation pssh [root @ localhost ~] # tar xf pssh-2.3.1.tar.gz [root ~] # cd pssh-2.3.1 [root@localhost ~] # python setup.py install configuration Private login [root@localhost ~] # ssh-keygenGenerating public/private rsa key pair.Enter file in which to save the key (/ root/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again:Your identification has been saved in / root/.ssh/id_rsa.Your public key has been saved in / root/.ssh/id_rsa.pub.The key fingerprint is:SHA256:3antaxjGw+hdgfSlrXLYhUe5vgHe9b0ehh/gUY9E8Eg root@localhost.localdomainThe key's randomart image is:+--- [RSA 2048] -+ | E. |. + + | |. O.*oo | |. * oroom.o | | scoundrel. Roomoplastics. + | |. OoB B o | |. O.B.o *. | |. o.。 + .o | | .o | +-[SHA256]-+ [root@localhost ~] # cd / root/.ssh/ [root@localhost .ssh] # lsid_rsa id_ rsa.pub[ root @ localhost .ssh] # ssh-copy-id 172.16.1.112/usr/bin/ssh-copy-id: INFO: Source of key (s) to be installed: "/ root/.ssh/id_rsa.pub" The authenticity of host '172 .16.1.112 (172.16.1.112) 'can't be established.ECDSA key fingerprint is SHA256:yFvaxR1x5YDhhe+6xR/Ou6Sm+YPYvPAoiLVKt9mAnXA.ECDSA key fingerprint is MD5:0d:c4:79:bc:36:7a:a4:82:95:4f:d5:d0:a3:c8:7d:2e.Are you sure you want to continue connecting (yes/no)? Yes/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key (s), to filter out any that are already installed/usr/bin/ssh-copy-id: INFO: 1 key (s) remain to be installed-- if you are prompted now it is to install the new keysroot@172.16.1.112's password:Number of key (s) added: 1Now try logging into the machine With: "ssh '172.16.1.112'" and check to make sure that only the key (s) you wanted were added. [root@localhost .ssh] # ssh-copy-id 172.16.1.16/usr/bin/ssh-copy-id: INFO: Source of key (s) to be installed: "/ root/.ssh/id_rsa.pub" The authenticity of host' 172.16.1.16 (172.16.1.16) 'can't be established.ECDSA key Fingerprint is SHA256:ANzlXzrGA87YLI2vzkPJ/iNPiSQ5JStJc95948jE8aw.ECDSA key fingerprint is MD5:f9:f1:1b:5a:99:64:d8:d8:e9:9b:e6:bb:c3:d5:bd:e7.Are you sure you want to continue connecting (yes/no)? Yes/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key (s), to filter out any that are already installed/usr/bin/ssh-copy-id: INFO: 1 key (s) remain to be installed-- if you are prompted now it is to install the new keysroot@172.16.1.16's password:Number of key (s) added: 1Now try logging into the machine, with: "ssh '172.16.1.16'" and check to make sure that only the key (s) you wanted were added. Test secret-free login [root@localhost ~] # ssh 172.16.1.112Last login: Tue Jun 2 09:44:24 2020 from 172.16.1.16 [root@localhost ~] # ssh 172.16.1.16Last login: Tue Jun 2 09:30:47 2020 from 172.16.1.100 Test pssh

Create an aaa file to store the ip address

[root@localhost ~] # cat aaa172.16.1.16172.16.1.112

Batch execution of date commands

[root@localhost] # pssh-h aaa-l root-P "date" 172.16.1.16: Tuesday, 02 June, 2020 09:59:48 CST [1] 09:59:48 [SUCCESS] 172.16.1.16172.16.1.112: Tuesday, 02 June, 2020 09:59:48 CST [2] 09:59:48 [SUCCESS] 172.16.1.112

View disk

[root@localhost] # pssh-h aaa-l root-P "lsblk" 172.16.1.16: NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTsda 8:0 0 20G 0 disk ├─ sda1 8:1 0 1G 0 part / boot └─ sda2 8:2 0 19G 0 part ├─ centos-root 253 lvm / └─ centos-swap 251 0 2G 0 lvm [SWAP] sr0 11:0 1 4.2G 0 rom [1] 10:13:02 [SUCCESS] 172.16.1.16172.16.1.112: NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTsda 8:0 0 20G 0 disk ├─ sda1 8:1 0 1G 0 part / boot └─ sda2 8:2 0 19G 0 part ├─ centos -root 253 lvm 0 17G 0 lvm / └─ centos-swap 253 lvm 1 0 2G 0 lvm [SWAP] sr0 11:0 1 4.2 G 0 rom [2] 10:13:03 [SUCCESS] 172.16.1.112

Pssh deployed!

This is the end of the introduction on "how to deploy pssh in Centos7". Thank you for reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report