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

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

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

延伸 · 閱讀

精彩推薦
主站蜘蛛池模板: 14一15sexvideo日本 | 国产亚洲精品看片在线观看 | 刺激一区仑乱 | 亚洲欧美日韩成人一区在线 | 图片专区亚洲欧美另类 | 人妇小说 | 精品一区二区三区五区六区七区 | 1024视频色版在线网站 | 国产精品天天在线 | 美女张开大腿让男人桶 | 免费午夜影片在线观看影院 | h卡通第一页 | 97午夜视频 | 三级网站午夜三级 | 91chinese 永久免费| 欧洲vodafonewifi日本 | 国内老司机精品视频在线播出 | 亚洲精品www久久久久久久软件 | 97香蕉超级碰碰碰久久兔费 | 精品国产乱码久久久久久免费 | 日韩一级片在线播放 | 精选国产AV精选一区二区三区 | 边摸边吃奶又黄激烈视频韩国 | 青春草视频免费观看 | www红色一片在线观看版 | 国产精品福利在线观看免费不卡 | 国产欧美成人免费观看 | ai换脸明星造梦工厂忘忧草 | 免费特黄一级欧美大片 | 国产成人8x视频一区二区 | 爱情岛论坛亚洲品质自拍视频 | 催眠白丝舞蹈老师小说 | 四虎影视在线影院在线观看观看 | 久久99re热在线播放7 | 国产一页 | 闺蜜高h | 99精品国产自产在线观看 | 成人男女啪啪免费观看网站 | 三级午夜宅宅伦不卡在线 | 五月婷婷俺也去开心 | 国产成人精品视频午夜 |