如何修复Net :: SSH :: Expect"SSHAuthenticationError登录超时";使用Parallel :: Forkmanager时出现问题? [英] how to fix the Net::SSH::Expect "SSHAuthenticationError Login timed out" issue while using Parallel::Forkmanager?
问题描述
当我使用Parallel :: Forkmanager完成远程ssh的并行处理时,如果远程设备不可访问,则遇到"SSHAuthenticationError登录超时"问题,然后STDOUT完全混乱了. 那么,如何解决这个混乱的STDOUT问题呢? 为什么我们可以使用eval {ssh operation}来解决? 谢谢.
When I use the Parallel::Forkmanager to accomplish parallel process for remote ssh, I met "SSHAuthenticationError Login timed out" issue if the remote device is unreachable and then the STDOUT is totally messed up. So how can I fix this messed STDOUT issue? Why we can use the eval{ ssh operation } to work around? Thanks.
推荐答案
您可以尝试网络:: OpenSSH ,它甚至可以让您在所有主机上并行运行这些操作,而不会带来太多麻烦.
You can try Net::OpenSSH, it would even let you run the operations in parallel in all the hosts without too much hassle.
您也可以尝试增加timeout
.
另一种可能的解决方案可能是如下
Another possible solution might be something like below
my $retry_count = 0;
while(1){
$rc = eval{$ssh->login();};
last if defined $rc;
last if $retry_count >= $max_retry_count;
$retry_count++;
sleep 1;
}
另请参阅: Net :: SSH :: Perl,Net :: SSH :: Expect崩溃时脚本主机无法访问
这篇关于如何修复Net :: SSH :: Expect"SSHAuthenticationError登录超时";使用Parallel :: Forkmanager时出现问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!