【发布时间】:2017-02-01 19:14:48
【问题描述】:
当 Packer 到达“等待 SSH 可用...”步骤时。
我的日志显示
14:07:29 [INFO] Attempting SSH connection...
14:07:29 reconnecting to TCP connection for SSH
14:07:29 handshaking with SSH
14:07:29 handshake error: ssh: handshake failed: read tcp 127.0.0.1:60372->127.0.0.1:3057: read: connection reset by peer
14:07:29 [DEBUG] SSH handshake err: ssh: handshake failed: read tcp 127.0.0.1:60372->127.0.0.1:3057: read: connection reset by peer
14:07:36 [INFO] Attempting SSH connection...
14:07:36 reconnecting to TCP connection for SSH
14:07:36 handshaking with SSH
14:07:36 handshake error: ssh: handshake failed: read tcp 127.0.0.1:60376->127.0.0.1:3057: read: connection reset by peer
14:07:36 [DEBUG] SSH handshake err: ssh: handshake failed: read tcp 127.0.0.1:60376->127.0.0.1:3057: read: connection reset by peer
每次尝试时请注意不同的端口。
60372
60376
Packer 每 7 秒尝试一个新端口。
有没有办法在构建之前或构建期间配置端口以避免这种尝试/失败方法?
【问题讨论】:
-
您看到的是 TCP 客户端的典型行为。您想在这里解决什么问题?
-
问题是找到好端口的时间在 10 到 60 分钟之间。它使构建变得不可预测并且偶尔会超时。我的詹金斯工作是 45 分钟。当我手动运行打包程序时,通常需要 5-15 分钟。
-
"connection reset by peer" 通常表示 ssh 服务器有问题。您确定客户端使用的源端口与您的问题相关吗?
-
如果我等待足够长的时间,连接最终会建立,其余的都会按预期完成。如何对 ssh 服务器进行故障排除?我应该寻找什么?作为用户,我使用 Powershell SSH 远程访问服务器。它会影响其他传出连接吗?