Operation of a server can be SSH, operating multiple servers can open multiple Windows SSH, which operates a lot of servers?
There are about 60 Ubuntu servers on our Oracle gird Engine cluster that are performing nodes, and the server operating systems and software configurations are exactly the same (after the line is configured by the puppet), and sometimes we need to do the same on these servers, This time is especially good for using the PSSH SSH Bulk Operation tool.
Of course, if you're not afraid of Python, you can use Fabric to bulk perform server tasks.
Download and install Pssh:
$ git clone http://code.google.com/p/parallel-ssh/
$ CD parallel-ssh/
$ sudo python setup.py install
Bulk execution
First create a new server list file, add the hostname (or IP address) of the server you need to operate, and then you can execute the uptime command in bulk,-l Specify the login username,-a asks for the password, h specifies the server list file:
$ VI Grids
Grid01
Grid02
Grid03
Grid04
Grid05
$ pssh-i-L root-a-H grids ' uptime '
Warning:do Not enter your password if anyone else has superuser
Privileges or access to your account.
Password:
[1] 05:42:09 [SUCCESS] Grid01
11:42:09 up 620 days, 20:30, 0 users, Load average:6.09, 6.14, 6.13
[2] 05:42:09 [SUCCESS] Grid03
11:42:09 up 620 days, 20:29, 0 users, Load average:9.01, 9.04, 9.05
[3] 05:42:09 [SUCCESS] Grid05
11:42:09 up 620 days, 20:10, 0 users, Load average:8.46, 8.18, 8.10
[4] 05:42:09 [SUCCESS] Grid04
11:42:09 up 620 days, 20:25, 0 users, Load average:6.00, 6.01, 6.05
[5] 05:42:10 [SUCCESS] grid02
11:42:10 up 606 days, 2:07, 0 users, Load average:6.03, 6.02, 6.01
Bulk upload
Bulk upload Local files linux-3.14.3.tar.xz to the/tmp directory on the server:
$ pscp-l root-a-H grids linux-3.14.3.tar.xz/tmp/
Warning:do Not enter your password if anyone else has superuser
Privileges or access to your account.
Password:
[1] 05:56:16 [SUCCESS] Grid01
[2] 05:56:16 [SUCCESS] Grid03
[3] 05:57:04 [SUCCESS] Grid05
[4] 05:57:04 [SUCCESS] Grid04
[5] 05:57:05 [SUCCESS] grid02
Bulk Download
Bulk download a file on the server to the local, do not worry about the duplicate name problem, because PSSH has established grid01, GRID02, ..., grid05 directory to store downloaded files:
$ pslurp-l root-h grids-a/tmp/linux-3.14.3.tar.xz.
Warning:do Not enter your password if anyone else has superuser
Privileges or access to your account.
Password:
[1] 06:06:01 [SUCCESS] Grid01
[2] 06:06:01 [SUCCESS] Grid03
[3] 06:06:06 [SUCCESS] Grid04
[4] 06:06:06 [SUCCESS] grid02
[5] 06:06:06 [SUCCESS] Grid05
$ ls
GRID01 grid02 grid03 grid04 grid05 grids linux-3.14.3.tar.xz parallel-ssh
Bulk Sync
Sometimes we need to keep the data on the development machine (in a directory) consistent with the data on the server:
$ prsync-l root-h grids-a-R develop//tmp/production/
Warning:do Not enter your password if anyone else has superuser
Privileges or access to your account.
Password:
[1] 06:12:52 [SUCCESS] Grid05
[2] 06:12:52 [SUCCESS] Grid01
[3] 06:12:52 [SUCCESS] Grid04
[4] 06:12:52 [SUCCESS] grid02
[5] 06:12:52 [SUCCESS] Grid03