什么是好的现代并行 SSH 工具?

fau*_*ver 31 ssh remote

我听说过,pssh并且clusterssh是两个流行的,但我想我会在这里打开它进行讨论,看看社区对这些工具的体验是什么?有什么问题?任何体面的黑客或用例?

use*_*321 23

我使用过 pssh,它很简单,而且效果很好。它非常适合快速查询。

如果您发现自己在管理服务器,我建议您使用更强大且稍有不同的领域(配置管理),例如 Puppet 或 CFEngine。

  • 我还应该补充 - 根据您在做什么,可能会有很多使用 pssh 和 clustersh 之类的工具的问题。例如- 编辑或删除文件。很容易出错。作为一般经验法则,我只使用 pssh 进行状态查询。对于更复杂的任何事情,我使用 puppet,因为它可以让我在将其发送到生产服务器之前测试我的测试环境中的更改。 (2认同)

ror*_*ycl 9

Its important to know what you want to do. If you want to run 'apt-get update' on lots of servers, clusterssh is reportedly an easy-to use and effective tool. See Kyle Rankin's article on clusterssh at the Linux Journal.

If your work on different servers will require logic loops, putting, getting or otherwise interacting with each host (or possibly having to interact with a host because of an error condition) a tool such as Fabric (which has just hit its 1.0 release) is invaluable. You'll probably enjoy most using Fabric if you are a pythonista.

In either case one is probably expecting to do fairly simple tasks on the remote servers affected, and dropping in specially on any problem hosts. However Fabric provides more options for dealing with variation.

通常处理得不好的一件事是处理网关主机后面的多个主机,需要先连接到网关,然后从那里进行端口转发。由于 ssh 本身很简单,因此可以将自己的.ssh/config文件设置为类似

Host gateway
    Port 9000
    User remoteadmin
    HostName datacentre1.com
    # mail
    LocalForward 9100 192.168.9.11:22
    # phones
    LocalForward 9101 192.168.9.12:22

Host dc1mail
    Port 9100
    Host 127.0.0.1
    User localadmin

Host dc1phones
    Port 9201
    Host 127.0.0.1
    User localadmin
Run Code Online (Sandbox Code Playgroud)

为了做与ssh dc1mail 'cmd'&&的等价物,ssh dc1phones 'cmd'必须首先提出ssh gateway. 如果像 clustersh 和 Fabric 这样的工具允许将其作为其工具的一部分来完成,那就太好了。当然,您可以自己手动完成此操作。


小智 5

所述SSH电动工具(sshpt)被设计为平行SSH而不需要用户设置预共享SSH密钥。它优于 pssh 和 clustersh,因为它支持通过 sudo 执行,还可以复制文件并在之后执行它们(可选,也通过 sudo)。默认情况下,它以 CSV 格式输出结果,但 sshpt.py 兼作可导入的 Python 模块,因此您可以在自己的程序中使用它(我曾经将它用作我的自定义构建的基于 Web 的报告工具背后的后端)上任老板)。