Master Parallel SSH (PSSH): Run Commands, Transfer Files, Sync Servers
This guide explains how to use Parallel SSH (PSSH) to execute commands, copy files, and synchronize directories across multiple servers, including installation steps and configuring password‑less SSH for streamlined server management.
PSSH stands for Parallel SSH, allowing a single command to be executed simultaneously on multiple servers, simplifying cluster management.
Example to view load on all servers: pssh -h hostlist -i w where hostlist is a text file listing servers, e.g.:
[email protected]:22
[email protected]:22PSSH examples
Copy a local file to all servers:
pscp -h hostlist /root/fileA /tmp/fileACopy a file from all servers to the local machine:
pslurp -h hostlist -L /tmp/test /home/err_log logSynchronize a local directory to each server:
prsync -h hostlist -a -r /tmp/test /homePSSH installation
Download:
https://pypi.python.org/packages/source/p/pssh/pssh-2.3.1.tar.gzExtract: tar xzvf pssh-2.3.1.tar.gz Install: cd pssh-2.3.1 && python setup.py install Test: pssh --help and run a command, e.g.
pssh -H [email protected] -A -i dateConfigure password‑less SSH
Generate a key pair with ssh-keygen (accept defaults), then copy the public key to each server: ssh-copy-id -i /root/.ssh/id_rsa -p 22 [email protected] After copying keys, subsequent pssh commands no longer prompt for a password.
PSSH is lightweight, easy to install, and can dramatically speed up routine server‑administration tasks.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Java High-Performance Architecture
Sharing Java development articles and resources, including SSM architecture and the Spring ecosystem (Spring Boot, Spring Cloud, MyBatis, Dubbo, Docker), Zookeeper, Redis, architecture design, microservices, message queues, Git, etc.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
