缓慢的远程MySQL连接 [英] Slow remote MySQL connection
问题描述
我有一个使用远程MySQL DB连接的本地WordPress安装设置。 MySQL服务器是我的VPS,我的VPS也是DNS服务器。
I have a local WordPress installation setup that uses a remote MySQL DB connection. The MySQL server is my VPS, and my VPS is also the DNS server.
我使用 skip-name-resolve
选项,如其他帖子建议的。
I have MySQL setup with the skip-name-resolve
option, as suggested by other posts. The connection still takes a good 5 seconds to load though.
我在Webmin中使用BIND来管理我的DNS。我不是任何方式的专家...
I'm using BIND inside Webmin to manage my DNS. I am no expert by any means...
有关如何提高我的本地机器和MySQL远程服务器之间的性能的任何想法?
Any ideas on how to improve performance between my local machine and MySQL remote server?
注意:如果它是相关的,当我在服务器IP地址上运行DIG命令,它回到5mil秒。我也有在我的iptables中打开端口3306.
Note: if it's relevant, when I run a DIG command on the server IP address, it comes back in 5mil seconds. I also have port 3306 opened up in my iptables.
推荐答案
如果你的客户端机器可以解决服务器的毫秒。 MySQL本身也必须对客户端的IP地址进行反向DNS查找,以验证其他方向的连接。例如。如果您创建了您的帐户 foo @ clientmachine
,那么MySQL必须解析您的客户端的IP,看看它是否解析为 clientmachine
。
Doesn't matter if your client machine can resolve the server's in milliseconds. MySQL itself has to do a reverse DNS lookup on your client's IP address as well, to validate the connect in the other direction. E.g. if you created your account as foo@clientmachine
, then MySQL has to resolve your client's IP and see if it resolves to clientmachine
.
您可以使用虚线四边形来加快速度,例如 foo@1.2.3.4
,因为这将是mysql检查的第一个东西,在尝试做PTR查找之前。
You could probably speed things up by using a dotted quad instead, e.g. foo@1.2.3.4
, because that'll be the FIRST thing mysql checks, before it tries to do the PTR lookup.
这篇关于缓慢的远程MySQL连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!