0

我在 Mac 上使用 MySqlWorkbench 并使用 SSH 连接到多个远程服务器。

其中 2 个是本地的 - 一个在我的本地 VM 中,一个在整个房间的服务器上。第三个是世界范围内其他地方的摇摆不定。

我可以愉快地打开工作台并立即连接到我的 2 台本地服务器。

我可以打开工作台,几个小时什么都不做,然后连接到它们,一切仍然有效。

我可以打开工作台并立即连接到远程服务器。一切都很好。

但是,如果我尝试在任何延迟(比如一个小时左右)后连接到真正的远程服务器,我会收到错误消息。

Your connection attempt failed for user 'root' from your host to server at 127.0.0.1:3306:
Tunnel error: Remote connection to 127.0.0.1:3306 failed: IOError('open SSH channel timeout',)

Please:
1 Check that mysql is running on server 127.0.0.1
2 Check that mysql is running on port 3306 (note: 3306 is the default, but this can be changed)
3 Check the root has rights to connect to 127.0.0.1 from your address (mysql rights define what clients can connect to the server and from which machines) 
4 Make sure you are both providing a password if needed and using the correct password for 127.0.0.1 connecting from the host address you're connecting from

此时,我关闭应用程序,重新打开它,建立连接,一切都很好。

但是非常令人沮丧的是不得不等待 30 秒左右才能意识到我不会建立连接,然后不得不关闭应用程序然后重新打开它。

有时应用程序崩溃,但不够频繁。

关于我可以做些什么来帮助识别问题并消除它的任何建议?

问候,

理查德。

4

1 回答 1

0

如果我正确理解了这个场景,那么如果它空闲一段时间,你就会遇到连接死机的问题。尝试设置 keepalive 选项以保持每隔几秒钟生成一些数据包。这应该可以防止您的连接中断。

如果您自己设置连接,请添加-o TCPKeepAlive=yes到命令行。如果是某个应用程序为您启动连接,则设置:

Host *
TCPKeepAlive yes

在你~/.ssh/config应该做的伎俩。

于 2013-10-01T12:19:33.847 回答