简体   繁体   English

parallel-ssh使用的hosts.txt在哪里

[英]Where is hosts.txt that parallel-ssh uses

this might sound silly but I'm really stuck here... 这听起来可能很愚蠢,但我真的被困在这里...

I want parallel-ssh to preform operations on multiple hosts and I know I have to put their IPs in file hosts.txt, but where is this fabled hosts.txt file? 我希望parallel-ssh在多个主机上执行操作,并且我知道我必须将其IP放在文件hosts.txt中,但是这个寓言的hosts.txt文件在哪里? Or if I have to create it, where? 或者,如果我必须创建它,在哪里? Because I keep getting this: 因为我不断得到这个:

IOError: [Errno 2] No such file or directory: 'hosts.txt' IOError:[Errno 2]没有这样的文件或目录:'hosts.txt'

You have to create it. 您必须创建它。 one host per line. 每行一台主机。

create a file called hosts.txt and in the contents have: 创建一个名为hosts.txt的文件,其内容包括:

host1.mydomain.com  
host2.mydomain.com

then you pass that file in as an option pssh -h hosts.txt ... 然后您将该文件作为选项pssh -h hosts.txt ...

That file can have any name really, so long as it's a list of hostnames. 该文件实际上可以具有任何名称,只要它是主机名列表即可。 You could save it as myhosts.txt , as an example. 例如,您可以将其另存为myhosts.txt

pssh -h myhosts.txt ...

You can create this file where ever you like. 您可以随时随地创建此文件。 If you are on a windows machine you can create it in c:\\temp or on a *nix box in /tmp/ or where ever. 如果您使用的是Windows计算机,则可以在c:\\ temp或/ tmp /的* nix框中或任何位置创建它。

then you can go: 那么你可以去:

pssh -hc:\\temp\\hosts.txt or... pssh -hc:\\temp\\hosts.txt或...
pssh -h /tmp/hosts.txt or... pssh -h /tmp/hosts.txt或...
pssh -hc:\\temp\\myhosts.txt

您可以使用-h选项或PSSH_HOSTS环境变量来指定它:

 pssh [OPTIONS] -h hosts.txt prog [arg0] ...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM