PSSH,PDSH,MUSSH,CSSH,DSH operation and Maintenance tools introduction

Source: Internet
Author: User
Tags syslog pscp

Pssh

1 Installation:
#wget http://peak.telecommunity.com/dist/ez_setup.py
python ez_setup.py
#wget http://parallel-ssh.googlecode.com/files/pssh-2.2.2.tar.gz
# tar zxvf pssh-2.2.2.tar.gz
# CD pssh-2.2.2
# python setup.py install
2 pssh using (assuming SSH trust ssh, SSH trust see: About SSH command research and SSH Trust details)
The PSSH Toolkit consists of 5 main programs:
1 PSSH Multi-host parallel Run command
[email protected] pssh-2.2.2]# pssh-p-h test.txt uptime
192.168.9.102:14:04:58 up days, 17:05, 0 users, load average:0.07, 0.02, 0.00
192.168.9.102: [1] 14:04:58 [SUCCESS] 192.168.9.102 9922
192.168.8.171:14:04:59 up + days , 2:01, 6 users, Load average:0.00, 0.00, 0.00
192.168.8.171: [2] 14:04:59 [SUCCESS] 192.168.8.171
192.168.9.104:14:04:59 up 7 days, 20:59, 0 users, load average:0.10, 0.04, 0.01
192.168.9.104: [3] 14:04:59 [SUCCESS] 192.168.9.104 9922
[email protected] pssh-2.2.2]# cat Test.txt
192.168.9.102:9922
192.168.9.104:9922
192.168.8.171:22//Note My port number is not only the default
If you want to redirect output to a file plus the-o option
2 pscp Copying files to multiple hosts in parallel
Note that the files are routed from the server side to the client:
[[email protected] pssh-2.2.2]# pscp-h test.txt/etc/sysconfig/network/tmp/network//flag will be local/etc/sysconfig/ Network to the target server/tmp/network
3 Prsync Synchronizing from the local computer to a remote host using the Rsync protocol
[email protected] ~]# pssh-h test.txt-p mkdir/tmp/etc
[[email protected] ~]# prsync-h test.txt-l dongwm-a-r/etc/sysconfig/tmp/etc//indicates that the local/etc/sysconfig directory is recursively synchronized to the target server /tmp/etc directory, and keep the original timestamp, using the user Dongwm
4 pslurp Copy files from the remote host to local, in the opposite direction of PSCP:
[[email protected] ~]# pslurp-h test.txt-l/tmp/test-l root/tmp/network Test//Flag copy the/tmp/network file of the destination server to the local/tmp/t EST directory and renamed to test
[1] 14:53:54 [SUCCESS] 192.168.9.102 9922
[2] 14:53:54 [SUCCESS] 192.168.9.104 9922
[email protected] ~]# ll/tmp/test/192.168.9.10
192.168.9.102/192.168.9.104/
[email protected] ~]# ll/tmp/test/192.168.9.102/
Total 4.0K
-rw-r--r--1 root root 2011-04-22 14:53 test
[email protected] ~]# ll/tmp/test/192.168.9.104/
Total 4.0K
-rw-r--r--1 root root 2011-04-22 14:53 test
5 Pnuke Parallel in the remote host kill process:
[[email protected] ~]# pnuke-h test.txt syslog//Kill the syslog process of the target server, as long as the PS process in the occurrence of relevant words can kill
[1] 15:05:14 [SUCCESS] 192.168.9.102 9922
[2] 15:05:14 [SUCCESS] 192.168.9.104 9922

pdsh

1, the installation process of PDSH
PDSH installation is very simple, there are RPM packages and source package two ways, you can choose according to their own preferences suitable for their own installation method. You can download the latest source package in http://code.google.com/p/pdsh/to compile and install, currently the latest version is pdsh-2.29, the source code package is pdsh-2.29.tar.bz2 here. Compile the installation process as follows:

[Email protected] ~]# tar jxvf pdsh-2.29.tar.bz2
[Email protected] ~]# CD pdsh-2.29
[Email protected] pdsh-2.29]#./configure--with-ssh--with-rsh--with-mrsh--with-mqshell \
>--with-qshell--with-dshgroups--with-machines=/etc/pdsh/machines
[[email protected] pdsh-2.29]# make
[[email protected] pdsh-2.29]# make install

During the Configure phase, the "--with-ssh" parameter means that the SSH module is enabled, other parameters have a similar meaning, and "--with-dshgroups" means that host group support is enabled, and when this parameter is enabled, a list of host lists can be written to a file and placed into the ~/. Dsh/group or/etc/dsh/group directory, and then called by the "-G" parameter of PDSH. The last parameter, "--with-machines", is an extension of the "--with-dshgroups" parameter by writing all the host lists to be managed to the specified/etc/pdsh/machines file, followed by the Pdsh "-a" argument. Finally, all hosts are managed conveniently.

After the installation is complete, you can view the version number of the PDSH and the module information that you can use through "Pdsh–v", as follows:

[Email protected] ~]$ pdsh-v
pdsh-2.29
Rcmd modules:ssh,rsh,exec (Default:rsh)
Misc Modules:machines,dshgroup

In addition, you can display all currently loaded module information through "Pdsh-l". After the PDSH installation is complete, there is also an available tool PDCP, which will explain in detail the usage of the PDSH and PDCP two commands later.

2, PDSH Grammar Introduction
After the installation of PDSH is complete, you can get the full usage of two commands by executing "pdsh–h" and "Pdcp–h", because the parameters of two commands are similar, so the PDSH command is used to introduce some common parameters and meanings. The following table is the parameters commonly used in pdsh and their meanings.

-W Host,host Specify the remote host, you can specify multiple, each host is separated by commas, host can be the hostname or IP address. This parameter is very flexible and is commonly used in the following ways:
Pdsh-w ssh:user001,ssh:user002,ssh:user003 "Date"
This command is used to view the time on the user001, user002, user003 hosts, where SSH represents the execution of the command on the remote host, which defaults to RSH.
Pdsh-w ssh:user00[1-10] "date"
This command is used to execute the date command on user001 to user0010.
Pdsh-w ssh:user0[10-31],/1$/"Uptime"
This command uses a regular expression when selecting a remote host, indicating that the host name ending with 1 is selected in user010 to user031, which executes the user031 command on user011, user021, uptime


-r Specifies the module name using Rcmd, which is rsh by default. If you want to select SSH, you can specify the following:
Pdsh-r ssh-w user00[1-10] "date"

-l Specifies the user name to use on the remote host. For example:
Pdsh-r ssh-l opsuser-w user00[1-9] "date"

-X This parameter is used to exclude some or a host, for example:
Pdsh-r ssh-l opsuser-w user00[1-9]-x user005,user007 "date"

-T Specifies the time-out for connecting to a remote host, in seconds, by default of 10 seconds, which can be modified by this parameter, for example: Pdsh-r ssh-w slave000[1-9]-t 15 " Date "
-u sets the time-out for remote command execution, in seconds, when connecting SSH, the default time is infinite
-n This parameter is used to turn off host name display in results returned by the remote host
-a This parameter allows you to specify all remote hosts, after this parameter is set, PDSH will view the list of hosts in the/etc/machines file by default, to change this path, to be specified by the "--with-machines" parameter when compiling pdsh
Span style= "font-family: the song Body;" >-g This parameter is used to specify a set of remote hosts that can be activated by the "--with-dshgroups" parameter when compiling PDSH, by default a set of host lists can be written to a file and placed on the local host's ~/.dsh/group or/etc/dsh/ Group directory, so that it can be called by the "-G" parameter. For example: Pdsh-r ssh-g userhosts "Date", where "userhosts" is a host list file that can be placed in ~/.dsh/group or/etc/dsh/group directory

-X This parameter is used to exclude all hosts within a specified group and is often used with the "-a" parameter. For example:
Pdsh-r ssh-a-X userhosts "date"
-Q This parameter lists some of the configuration information when PDSH executes
-V This parameter to view the version information of the software and the available module information

Mussh

1. Installation

[Email protected] ~]$ apt-get Install Mussh

CsshDSH

PSSH,PDSH,MUSSH,CSSH,DSH operation and Maintenance tools introduction

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.