一区二区三区在线-一区二区三区亚洲视频-一区二区三区亚洲-一区二区三区午夜-一区二区三区四区在线视频-一区二区三区四区在线免费观看

服務器之家:專注于服務器技術及軟件下載分享
分類導航

Linux|Centos|Ubuntu|系統進程|Fedora|注冊表|Bios|Solaris|Windows7|Windows10|Windows11|windows server|

服務器之家 - 服務器系統 - Linux - Polysh命令實現多日志查詢的方法示例

Polysh命令實現多日志查詢的方法示例

2022-02-23 16:40愛情小傻蛋 Linux

大家應該都知道Polysh是一個交互式命令,可以在一臺服務器上批量的對一批服務器進行處理,運行交互式命令。下面這篇文章主要給大家介紹了關于利用Polysh命令實現多日志查詢的相關資料,需要的朋友可以參考,下面來一起看看

一、Polysh簡介

Polysh 是一個交互式命令,可以在一臺服務器上批量的對一批服務器進行處理,運行交互式命令。Polysh可以同時登錄多個遠程主機,而不需要通過relay一臺一臺的登錄,并執行相同的指令,方便了問題的排查和定位,大大減少了我們的工作量。

?
1
Polysh is a tool to aggregate several remote shells into one. It is used to launch an interactive remote shell on many machines at once. It is written in Python and requires Python ≥ 2.4.

注: 官方解釋:Polysh 是一個由幾個遠程腳本集合而成的工具,它被用于在許多服務器上運行一個交互式的遠程腳本,由 Python 編寫,最低要求為 Python 2.4 。

二、polysh安裝

通過relay登錄staging機器,執行如下命令安裝polysh。安裝目錄為用戶目錄: /opt/hl/。

1.已安裝python的安裝

?
1
2
3
4
wget wget http://guichaz.free.fr/polysh/files/polysh-0.4.tar.gz
tar -zxvf polysh-0.4.tar.gz
 
vim prod-polysh.sh

腳本內容如下:

?
1
2
#10.252.176.33,10.252.176.35是你要鏈接的機器ip
python /opt/hl/polysh-0.4/polysh.py {10.252.176.33,10.252.176.35}

開放給其他用戶可執行的權限

?
1
chmod 777 prod-polysh.sh

2.未安裝python的安裝

?
1
2
3
4
5
6
7
wget wget http://guichaz.free.fr/polysh/files/polysh-0.4.tar.gz
tar -zxvf polysh-0.4.tar.gz
cd polysh-0.4
su
python setup.py install
 
vim prod-polysh.sh

腳本內容如下:

?
1
2
#10.252.176.33,10.252.176.35是你要鏈接的機器ip
python /opt/hl/polysh-0.4/polysh.py {10.252.176.33,10.252.176.35}

開放給其他用戶可執行的權限

?
1
chmod 777 prod-polysh.sh

三、Xshell配置Xagent(mac可跳過這一步)

打開文件-屬性,選擇SSH選項,選擇”使用密碼處理的Xagent(SSH代理)”。然后將Xshell重啟。

四、polysh使用

4.1.使用方法一

?
1
polysh 10.252.176.33 10.252.176.35

4.2.使用方法二

?
1
./prod-polysh.sh

則會出現如下提示信息

?
1
2
[---hl-----]$ ./prod-polysh.sh
ready (8)

ready (8) 表示 8臺機器已經連接完畢,可以執行查詢命令。exit或Crtl+z都可以退出。

4.3.執行命令

?
1
2
ready (8)>cd /opt/hl
ready (8)>pwd

顯示如下:

?
1
2
10.252.176.33: /opt/hl
10.252.176.35 : /opt/hl

五、源碼

可以通過git獲取polysh的源碼

?
1
git clone git://repo.or.cz/polysh.git

六、其他

以冒號開頭的指令不會發送到遠程主機,polysh會執行以冒號開頭的指令,例如:

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
ready (2)> :help
:add Add one or many remote shells.
:chdir Change the current directory of polysh (not the remote shells).
:disable Disable sending commands to remote shells.
:enable Enable sending commands to remote shells.
:export_vars Export some environment variables on enabled remote shells.
:help List control commands or show their documentations.
:hide_password Do not echo the next typed line.
:list List remote shells and their states.
:purge Delete disabled remote shells.
:quit Quit polysh.
:reconnect Try to reconnect to disconnected remote shells.
:rename Rename all enabled remote shells with the argument.
:replicate Copy a path from one remote shell to all others
:reset_prompt Change the prompt to be recognized by polysh.
:send_ctrl Send a control character to remote shells.
:set_debug Enable or disable debugging output for remote shells.
:set_log Duplicate every console I/O into the given local file.
:show_read_buffer Print the data read by remote shells.
:upload Upload the specified local path to enabled remote shells.

總結

以上就是這篇文章的全部內容了,希望本文的內容對大家的學習或者工作具有一定的參考學習價值,如果有疑問大家可以留言交流,謝謝大家對服務器之家的支持。

原文鏈接:http://www.jianshu.com/p/2ed0ad5ccb3f

延伸 · 閱讀

精彩推薦
主站蜘蛛池模板: 午夜私人影院在线观看 | 日本高清在线观看天码888 | 亚洲精品乱码蜜桃久久久 | 国产 日韩欧美 | gogort99人体专业网站 | 色呦呦在线免费观看 | 久久久久久免费高清电影 | 人妖欧美一区二区三区四区 | 九色PORNY真实丨国产大胸 | 免费人成黄页在线观看69 | 久久机热免费视频 | 亚洲黑人巨大videos0 | 香蕉国产人午夜视频在线 | 日本高清中文字幕 | a级在线看| 亚洲国产综合久久久无码色伦 | 9总探花新品牛仔背带裤 | 午夜AV内射一区二区三区红桃视 | 女教师巨大乳孔中文字幕免费 | 忘忧草在线社区WWW日本-韩国 | 亚洲AV午夜精品麻豆AV | 粉嫩尤物在线456 | 亚洲一级视频在线观看 | porono日本动漫 | 99久久免费精品视频 | 男人与禽交的方法 | 国产福利资源 | 幻女free性zoz0交 | 日本五级床片全都免费播放 | 免看一级一片一在线看 | 亚洲国产99在线精品一区二区 | 天天做天天爰夜夜爽 | 亚洲欧美日韩久久一区 | 日韩精品视频在线播放 | 四虎影视在线看 | 99热com| 日韩欧美三级视频 | 5g影院成人 | 青青草99热久久 | 国产一级视频久久 | 果冻传媒天美传媒网址入口 |