国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 服務器 > Web服務器 > 正文

Polysh命令實現(xiàn)多日志查詢的方法示例

2024-09-01 13:53:30
字體:
來源:轉載
供稿:網友

一、Polysh簡介

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

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機器,執(zhí)行如下命令安裝polysh。安裝目錄為用戶目錄: /opt/hl/。

1.已安裝python的安裝

wget wget http://guichaz.free.fr/polysh/files/polysh-0.4.tar.gztar -zxvf polysh-0.4.tar.gzvim prod-polysh.sh

腳本內容如下:

#10.252.176.33,10.252.176.35是你要鏈接的機器ippython /opt/hl/polysh-0.4/polysh.py {10.252.176.33,10.252.176.35}

開放給其他用戶可執(zhí)行的權限

chmod 777 prod-polysh.sh

2.未安裝python的安裝

wget wget http://guichaz.free.fr/polysh/files/polysh-0.4.tar.gztar -zxvf polysh-0.4.tar.gzcd polysh-0.4 su python setup.py installvim prod-polysh.sh

腳本內容如下:

#10.252.176.33,10.252.176.35是你要鏈接的機器ippython /opt/hl/polysh-0.4/polysh.py {10.252.176.33,10.252.176.35}

開放給其他用戶可執(zhí)行的權限

chmod 777 prod-polysh.sh

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

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

四、polysh使用

4.1.使用方法一

polysh 10.252.176.33 10.252.176.35

4.2.使用方法二

./prod-polysh.sh

則會出現(xiàn)如下提示信息

[---hl-----]$ ./prod-polysh.shready (8)

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

4.3.執(zhí)行命令

ready (8)>cd /opt/hlready (8)>pwd

顯示如下:

10.252.176.33: /opt/hl10.252.176.35 : /opt/hl

五、源碼

可以通過git獲取polysh的源碼

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

六、其他

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

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.

總結

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

 

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 邵东县| 绿春县| 巧家县| 长海县| 镇安县| 马公市| 贡觉县| 当涂县| 阳泉市| 盈江县| 邓州市| 都匀市| 广饶县| 西青区| 平昌县| 云龙县| 昆明市| 景洪市| 兴安盟| 栾城县| 纳雍县| 霍邱县| 城市| 江达县| 永嘉县| 县级市| 舟山市| 聂荣县| 威信县| 桑日县| 邵阳县| 东莞市| 雷山县| 綦江县| 深圳市| 长春市| 灵川县| 边坝县| 承德市| 隆安县| 博爱县|