LinuxBulk Management Server Gadgets--psshFirst, Introduction
Pssh--Parallel SSH program
PSSH is a program for executing SSH in parallel on a number of hosts. It provides features such as sending input to all of the processes, passing a password to SSH, saving output to files, and Timing out.
the simple understanding is that you can SSH , to operate a remote managed server in parallel.
Recommended, it is best to password-free login to all remotely managed servers, eliminating the hassle of entering passwords.
Second, installation
There are a lot of things on the internet Pssh the source of the installation, I will not introduce. The following describes my installation process, which is simple:
server operating system: Centos 6.5 x64 , itself Yum source, can be installed directly Pssh .
# yum-y Install Pssh
iii. usage and options
Pssh [Options ...] comand ...
Options:
- H host_file read hosts from the given host_file. user
- H Host hostto be[email protected]]host[:p ORT], the default isUserto beRoot,Portto be A, can be omitted. Can be followed by multipleHost
- L User Specify the user for default access
- T Timeout Specify the time-out, in seconds
- o outdir Specify the save path for standard output information, note the path, not the file
- I. display standard output and standard error messages to the terminal
Command : Shell script or a Linux the action command
Iv. Examples(MansManual provides)
Connect to Host1 and Host2, and print ' Hello, world ' from each:
Pssh-i-H "host1 host2" echo "Hello, World"
Print "Hello, World" from each host specified in the file hosts.txt:
Pssh-i-H hosts.txt echo "Hello, World"
Run a command as root with a prompt for the root password:
Pssh-i-H hosts.txt-a-L root echo Hi
Run a long command without timing out:
Pssh-i-H hosts.txt-t 0 sleep 10000
v. Practical use of work1.Bulk upgrade of a server project
pssh-h host_file-o out_start_log_directory-l user "export bash_env=/etc/profile; Project Upgrade Script . Sh "
2.real-time monitoring of the server's project log to the specified folder
nohup pssh-h host_file-lroot-t 0-o out_log_directory "Tail-f Project Log Path "> Out_nohup_log_directory &
This article is from the "Hades Blog" blog, please be sure to keep this source http://hades02.blog.51cto.com/9768670/1722322
Linux Batch Management Server gadget--pssh