並行管理工具pssh

來源:互聯網
上載者:User

並行管理工具pssh pssh是一個簡單的字元介面並發向多個伺服器發送指令進行執行的工具。適合一次性向叢集大量伺服器發送相同指令(並觀察輸出) 1. 安裝a. 到google code找到最新的安裝包http://code.google.com/p/parallel-ssh/downloads/listBash代碼  $ wget http://code.google.com/p/parallel-ssh/downloads/detail?name=pssh-2.3.1.tar.gz&can=2&q=  pssh是python寫的,因此下載之後解壓,安裝python安裝模組的方式安裝Bash代碼  $ tar -xf pssh-2.3.1.tar.gz    $ cd pssh-2.3.1    # python setup.py install   2. 準備為了方便使用,免去pssh時輸入密碼,需要產生rsa的key,然後拷貝到需要遠端管理的機器上。Bash代碼  # key-gen   一直斷行符號,會產生/root/.ssh/id_rsa.pub拷貝並添加到授權的檔案Bash代碼  # ssh-copy-id -i /root/.ssh/id_rsa.pub root@192.168.16.X  3. 使用建立一個hosts.txt檔案,將要遠端管理的機器加入Bash代碼  [root@localhost script]# cat hosts.txt   127.0.0.1  192.168.0.8  192.168.0.51  192.168.1.114  192.168.1.115   運行管理命令:Java代碼  [root@localhost script]# pssh -i -h hosts.txt "uptime"    [1] 10:49:19 [FAILURE] 127.0.0.1 22 Received error code of 255  [2] 10:49:19 [SUCCESS] 192.168.1.115 22   10:49:40 up 14 days, 17:50,  8 users,  load average: 0.00, 0.00, 0.00  [3] 10:49:19 [SUCCESS] 192.168.1.114 22   02:49:35 up 14 days, 17:52,  9 users,  load average: 0.11, 0.04, 0.01  [4] 10:49:19 [SUCCESS] 192.168.0.8 22   02:39:21 up 4 days, 29 min,  6 users,  load average: 0.00, 0.02, 0.03  [5] 10:49:19 [SUCCESS] 192.168.0.51 22   10:50:14 up 8 days, 38 min, 20 users,  load average: 0.03, 0.06, 0.06 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.