千家信息网

Polysh中怎么实现多日志查询

发表于:2026-11-03 作者:千家信息网编辑
千家信息网最后更新 2026年11月03日,这篇文章将为大家详细讲解有关Polysh中怎么实现多日志查询,文章内容质量较高,因此小编分享给大家做个参考,希望大家阅读完这篇文章后对相关知识有一定的了解。一、Polysh简介Polysh 是一个交互
千家信息网最后更新 2026年11月03日Polysh中怎么实现多日志查询

这篇文章将为大家详细讲解有关Polysh中怎么实现多日志查询,文章内容质量较高,因此小编分享给大家做个参考,希望大家阅读完这篇文章后对相关知识有一定的了解。

一、Polysh简介

Polysh 是一个交互式命令,可以在一台服务器上批量的对一批服务器进行处理,运行交互式命令。Polysh可以同时登录多个远程主机,而不需要通过relay一台一台的登录,并执行相同的指令,方便了问题的排查和定位,大大减少了我们的工作量。

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的安装

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}

开放给其他用户可执行的权限

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}

开放给其他用户可执行的权限

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

则会出现如下提示信息

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

ready (8) 表示 8台机器已经连接完毕,可以执行查询命令。exit或Crtl+z都可以退出。

4.3.执行命令

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

六、其他

以冒号开头的指令不会发送到远程主机,polysh会执行以冒号开头的指令,例如:

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.

关于Polysh中怎么实现多日志查询就分享到这里了,希望以上内容可以对大家有一定的帮助,可以学到更多知识。如果觉得文章不错,可以把它分享出去让更多的人看到。

命令 内容 机器 脚本 查询 交互式 指令 服务器 用户 服务 登录 日志 主机 使用方法 冒号 开头 文章 方法 更多 权限 数据库的安全要保护哪些东西 数据库安全各自的含义是什么 生产安全数据库录入 数据库的安全性及管理 数据库安全策略包含哪些 海淀数据库安全审计系统 建立农村房屋安全信息数据库 易用的数据库客户端支持安全管理 连接数据库失败ssl安全错误 数据库的锁怎样保障安全 云南咖啡 科技互联网 互联网新科技 北京互联网科技有限公司 互联网科技革命 互联网金融科技创新 银优互联网科技有限公司 一五八零互联网科技 多迪互联网科技有限公司 团飞科技与伯堂互联网服务平台 互联网企业和科技型企业 晓花互联网科技有限公司网址 广州新华互联网科技学校电竞方面 互联网时代的科技公司 互联网公司高科技产品 互联网科技资金流入 广州有谷有贝互联网科技有限公司 扫呗互联网科技有限公司 科技信息时代互联网发展 美国五大互联网科技公司市值多少 上海睿民互联网科技有限公司 科技股互联网 互联网与未来科技 上海亿帐通互联网科技 工业互联网等科技实现智能化赋能 昆明中奇联合互联网科技 互联网高科技行业有哪些企业 上海万顺科技互联网有限公司招聘 互联网时代高科技布局 黑龙江互联网科技公司
0