我有一个脚本,rsync是一个本地目录到大约10个远程服务器。 它基本上有一个服务器的列表,并通过每个人执行rsync循环。 为了加速这个过程,我们为每个rsyncs分叉,以便所有10个并行发生。 问题是最后几个服务器回来了“ssh_exchange_identification:由远程主机closures的连接”。 这在单独或串行执行rsyncs时不会发生,并在每个之间放置半秒的延迟来解决问题(通常,有时候列表中的最后一个服务器仍然会返回错误)。
有谁知道为什么会这样呢? 我认为这是rysnc的问题,而不是我的脚本,因为脚本只是系统调用rysnc。
我以前见过这个问题。 您需要调整连接到的SSH服务器上的MaxStartups值。 请注意,默认值是10.您可以通过编辑/etc/ssh/sshd_config并重新加载SSH守护程序(希望您控制远程服务器)来完成此操作。
从man sshd_config :
MaxStartups Specifies the maximum number of concurrent unauthenticated connections to the SSH daemon. Additional connections will be dropped until authentication succeeds or the LoginGraceTime expires for a connection. The default is 10. Alternatively, random early drop can be enabled by specifying the three colon separated values “start:rate:full” (eg "10:30:60"). sshd(8) will refuse connection attempts with a probability of “rate/100” (30%) if there are currently “start” (10) unauthenticated connections. The probability increases linearly and all connection attempts are refused if the number of unauthenticated connections reaches “full” (60).