在我将终端移动到另一台显示器之前,scp 卡住了,没有任何错误

scp stuck without any error until I move my terminal to another monitor

我们有一个简单的脚本,它会在每天凌晨 4 点 运行 复制生产数据库的最新备份并将其恢复到临时数据库:

/usr/bin/trickle -s -d 30720 -u 30720 -t 10 -l 100 /usr/bin/scp -r root@$MARIADB_REMOTE_HOST:$MARIADB_REMOTE_HOME $MARIADB_DATA_DIR || RESPONSE=$? && true

源 ($MARIADB_REMOTE_HOST) 是裸机服务器,目标是 KVM (OpenNebula) 的虚拟机 运行。两人 运行ning Ubuntu 18.04 .

上周我们更改了连接裸机的网络交换机,之后脚本将卡在 scp 中间的某个点。 它不遵循任何模式并且不退出;它只是卡住了,当我将我的终端移动到另一台显示器时,它再次启动(继续),显然这不是解决方案!!!

我尝试用“-v”运行它,但它没有帮助(由于我发送的 SIGTERM,最后一行由脚本打印):

Sending file modes: C0640 561 delivery_category_equivalency.frm.qp
Sink: C0640 561 delivery_category_equivalency.frm.qp
Sending file modes: C0640 3817 order_config_prioritization.ibd.qp
Sink: C0640 3817 order_config_prioritization.ibd.qp
Sending file modes: C0640 482 item_service.frm.qp
Sink: C0640 482 item_service.frm.qp
Sending file modes: C0640 429 feedback_record.frm.qp
Sink: C0640 429 feedback_record.frm.qp
Sending file modes: C0640 381409 order_configs.ibd.qp
Sink: C0640 381409 order_configs.ibd.qp
Sending file modes: C0640 35810042703 terminals.ibd.qp
Sink: C0640 35810042703 terminals.ibd.qp
debug1: SSH2_MSG_KEXINIT received
debug1: SSH2_MSG_KEXINIT sent
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: rekeying in progress
debug1: rekeying in progress
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:ngRaDyCEeh6BBJFLMC7xq2Cl5h/ICky2/+Hbn/UpUzY
debug1: ssh_set_newkeys: rekeying out, input 49398838524 bytes 134202402 blocks, output 8768056 bytes 19126 blocks
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: ssh_set_newkeys: rekeying in, input 49398838536 bytes 134202403 blocks, output 8768056 bytes 0 blocks
debug1: rekey in after 134217728 blocks
debug1: SSH2_MSG_KEXINIT received
debug1: SSH2_MSG_KEXINIT sent
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: rekeying in progress
debug1: rekeying in progress
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:ngRaDyCEeh6BBJFLMC7xq2Cl5h/ICky2/+Hbn/UpUzY
debug1: ssh_set_newkeys: rekeying out, input 50472727740 bytes 134203417 blocks, output 8960060 bytes 19238 blocks
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: ssh_set_newkeys: rekeying in, input 50472727752 bytes 134203418 blocks, output 8960060 bytes 0 blocks
debug1: rekey in after 134217728 blocks
debug1: SSH2_MSG_KEXINIT received
debug1: SSH2_MSG_KEXINIT sent
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: rekeying in progress
debug1: rekeying in progress
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:ngRaDyCEeh6BBJFLMC7xq2Cl5h/ICky2/+Hbn/UpUzY
debug1: ssh_set_newkeys: rekeying out, input 51546616956 bytes 134203417 blocks, output 9149904 bytes 19022 blocks
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: ssh_set_newkeys: rekeying in, input 51546616968 bytes 134203418 blocks, output 9149904 bytes 0 blocks
debug1: rekey in after 134217728 blocks
debug1: SSH2_MSG_KEXINIT received
debug1: SSH2_MSG_KEXINIT sent
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: rekeying in progress
debug1: rekeying in progress
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:ngRaDyCEeh6BBJFLMC7xq2Cl5h/ICky2/+Hbn/UpUzY
debug1: ssh_set_newkeys: rekeying out, input 52620506172 bytes 134203417 blocks, output 9340548 bytes 19102 blocks
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: ssh_set_newkeys: rekeying in, input 52620506184 bytes 134203418 blocks, output 9340548 bytes 0 blocks
debug1: rekey in after 134217728 blocks
debug1: channel 0: free: client-session, nchannels 1
debug1: fd 0 clearing O_NONBLOCK
debug1: fd 2 clearing O_NONBLOCK
Killed by signal 15.
        Removing old MariaDB's files failed at "20210722-0055" with 1 

不用说,当它卡住时,当我通过 iftoptcpdump.

检查时,我没有看到这两个服务器之间的任何流量

如果您分享您对如何解决此问题的想法,我将不胜感激。

使用这些选项测试您的 SCP

scp -o ServerAliveInterval=15 -o ServerAliveCountMax=3 <yourServerIP>:~

在此示例中,每 15 秒回头查看 ack,如果 45 秒 (15*3) 内有 3 个 ack 没有返回,则关闭会话。