pssh可以在控制机上并行执行命令吗?
现在我有三台机器。
这是我的
hostpssh
文件。它们对应于druidcluster1
,druidcluster2
,druidcluster4
。
[email protected]
[email protected]
[email protected]
ssh互信都建立了,包括ssh对每台机器本身的信任:
[root@druidcluster1 generalsoftware]# ssh druidcluster1 date
Sun May 12 02:02:49 CDT 2019
[root@druidcluster1 generalsoftware]# ssh druidcluster2 date
Sun May 12 02:02:55 CDT 2019
[root@druidcluster1 generalsoftware]# ssh druidcluster4 date
Sun May 12 02:03:01 CDT 2019
[root@druidcluster2 .ssh]# ssh druidcluster2 date
Sun May 12 02:02:19 CDT 2019
[root@druidcluster2 .ssh]# ssh druidcluster1 date
Sun May 12 02:02:25 CDT 2019
[root@druidcluster2 .ssh]# ssh druidcluster4 date
Sun May 12 02:02:31 CDT 2019
[root@druidcluster4 .ssh]# ssh druidcluster4 date
Sun May 12 02:02:01 CDT 2019
[root@druidcluster4 .ssh]# ssh druidcluster1 date
Sun May 12 02:02:08 CDT 2019
[root@druidcluster4 .ssh]# ssh druidcluster2 date
Sun May 12 02:02:14 CDT 2019
然后我执行pssh -h hostpssh -P date
并druidcluster1
得到:
[root@druidcluster1 generalsoftware]# pssh -h hostpssh -P date
[1] 01:33:34 [FAILURE] [email protected] Exited with error code 255
9.116.2.254: Sun May 12 01:33:37 CDT 2019
[2] 01:33:37 [SUCCESS] [email protected]
9.116.2.70: Sun May 12 01:33:37 CDT 2019
[3] 01:33:37 [SUCCESS] [email protected]
只是控制机上的命令失败了。