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 use the pssh command in Linux

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article will explain in detail how to use the pssh command in Linux. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.

Linux common commands pssh command is a python writing tool that can execute commands on multiple servers, while supporting copying files, is a very excellent tool of the same kind, similar to pdsh, I think it is more convenient than pdsh, and key authentication access must be configured on each server to use.

Pssh batch Management execution

Install pssh in the CentOS system environment, introduce the installation of yum and source code installation:

Yum method

Yum install pssh compilation and installation

Wget http://parallel-ssh.googlecode.com/files/pssh-2.3.1.tar.gz tar xf pssh-2.3.1.tar.gz cd pssh-2.3.1/ python setup.py install option-- version: view version-- help: view help, that is, this information-h: list of host files, content format "[user@] host [: port]"-H: host string Content format "[user@] host [: port]" -: user name used for login-p: number of concurrent threads [optional]-o: output file directory [optional]-e: error input file [optional]-t:TIMEOUT timeout setting 0 unlimited [optional]-options for O:SSH-v: detailed mode-A: manually enter password mode-x: additional command line arguments using blank symbols, quotation marks, backslash processing-X: additional command line arguments, single parameter mode, same as-x-I: internal processing information output for each server-P: print out the server return information instance to obtain the uptime of each server:

# pssh-h ip.txt-I uptime [1] 11:15:03 [SUCCESS] Mar.mars.he 11:15:11 up 4 days, 16:25, 1 user, load average: 0.00,0.00,0.00 [2] 11:15:03 [SUCCESS] Jan.mars.he 11:15:12 up 3 days, 23:26, 0 users, load average: 0.00,0.00,0.00 [3] 11:15:03 [SUCCESS] Feb.mars.he 11:15:12 up 4 days 16:26, 2 users, load average: 0.08,0.02,0.01 View mysql replication IO/SQL thread running status information on each server:

# pssh-h IP.txt-I "/ usr/local/mysql/bin/mysql-e 'show slave status\ G'" | grep Running: Slave_IO_Running: yes Slave_SQL_Running: Yes Slave_IO_Running: Yes Slave_SQL_Running: Yes Slave_IO_Running: Yes Slave_SQL_Running: Yes saves the results of each server:

# pssh-h IP.txt-I-o / tmp/pssh/ uptime [1] 11:19:47 [SUCCESS] Feb.mars.he 11:19:55 up 4 days, 16:31, 2 users, load average: 0.02,0.03,0.00 [2] 11:19:47 [SUCCESS] Jan.mars.he 11:19:56 up 3 days, 23:30, 0 users, load average: 0.01,0.00 0.00 [3] 11:19:47 [SUCCESS] Mar.mars.he 11:19:56 up 4 days, 16:30, 1 user, load average: 0.00,0.00,0.00 Let's take a look at the file under / tmp/pssh/ and its contents

# Total amount of ll / tmp/pssh/ 12-rw-r--r--. 1 root root 70 December 1 11:19 Feb.mars.he-rw-r--r--. 1 root root 70 December 1 11:19 Jan.mars.he-rw-r--r--. 1 root root 69 December 1 11:19 Mar.mars.he # cat / tmp/pssh/* 11:19:55 up 4 days, 16:31, 2 users, load average: 0.02,0.03,0.00 11:19:56 up 3 days, 23:30, 0 users, load average: 0.01,0.00,0.00 11:19:56 up 4 days, 16:30, 1 user, load average: 0.00,0.00 0.00 is a very small part of the pssh command. You can apply it to your own scene and make the most of it.

This is the end of the article on "how to use pssh commands in Linux". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.

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