V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
wsgzao
V2EX  ›  程序员

使用 csshX 同步管理多个 SSH 会话

  •  
  •   wsgzao ·
    wsgzao · 2018-11-26 19:14:46 +08:00 · 1430 次点击
    这是一个创建于 1977 天前的主题,其中的信息可能已经有所发展或是发生改变。

    前言

    终端登录管理方案非常成熟除了耳熟能详的跨平台付费方案 SeureCRT,Windows 有 Xshell,macOS 有 iTerm2,不过在 macOS 下想用到类似 SecureCRT 和 Xshell 一样的 Send to all 功能可能就没有这么方便了,而 csshX 正好可以满足批量管理操作的需求

    使用 csshX 同步管理多个 SSH 会话

    更新历史

    2018 年 11 月 26 日 - 初稿

    阅读原文 - https://wsgzao.github.io/post/csshx/

    扩展阅读

    csshx - https://github.com/brockgr/csshx


    csshx 简介

    As csshX is a command line tool, no special installation is needed. It may be copied into a directory in your path, (e.g. /usr/local/bin) for your convenience.

    The software has been tested on Mac OS X 10.5, 10.6 and 10.7 with the default Perl installation - no additional Perl modules are required.

    DOCUMENTATION:

    The documentation for csshX is self contained. Please run:

    csshX --man
    

    使用 brew 安装 csshx

    Name: csshx

    Use: Cluster ssh tool for Terminal.app

    URL: https://github.com/brockgr/csshx

    # 安装 homebrew
    ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" < /dev/null 2> /dev/null
    # 安装 csshx
    brew install csshx
    
    

    csshx 使用

    当我们管理数十台或更多 Linux 服务器的时候,往往需要在每台服务器上执行同样的命令,比如我们想一次查看 10 台服务器( node )上系统负载情况,或者想知道哪台服务器有剩余内存可以分给新客户,又或者想执行 df 命令看看哪个服务器上还有多的硬盘空间等等,除了可以用脚本或工具统一收集这些信息外,我们还可以考虑使用一些同步管理多个 SSH 会话的小工具来帮助管理多台服务器,节省时间提高管理效率。在 Linux 上可以用 pdsh、ClusterSSH 和 mussh ;在 Mac 上可以用 csshX.

    # 使用 csshX 很简单,如果要同时 ssh 到 4 个服务器可以直接传递 IP
    csshX 192.168.0.1 192.168.0.2 192.168.0.3 192.168.0.4
    
    # 也可以把这些要 ssh 管理的 IP 写到一个文件里,然后加载这个文件
    vi hosts
    192.168.0.1
    192.168.0.2
    192.168.0.3
    192.168.0.4
    
    csshX --hosts hosts
    
    2 条回复    2018-11-26 20:15:40 +08:00
    wsgzao
        1
    wsgzao  
    OP
       2018-11-26 20:11:16 +08:00
    csshx is not working in New Mac OS Release MacOS Mojave

    https://github.com/brockgr/csshx/issues/94

    brew install parera10/csshx/csshx
    ywgx
        2
    ywgx  
       2018-11-26 20:15:40 +08:00 via iPhone
    楼主,saltstack ansible 了解一下, 另外我还有企业级的解决方案 xabcloud.com
    玩就玩整个的,单纯的满足自己的需求不够畅快,也不能深入其中奥妙 😄
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5439 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 08:46 · PVG 16:46 · LAX 01:46 · JFK 04:46
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.