微软云 mysql连接不上_排查连接问题-Azure Database for MySQL | Microsoft Docs

您现在访问的是微软AZURE全球版技术文档网站,若需要访问由世纪互联运营的MICROSOFT AZURE中国区技术文档网站,请访问 https://docs.azure.cn.

排查 Azure Databases for MySQL 的连接问题Troubleshoot connection issues to Azure Database for MySQL

3/18/2020

本文内容

连接问题可能由多种因素造成,包括:Connection problems may be caused by a variety of things, including:

防火墙设置Firewall settings

连接超时Connection time-out

不正确的登录信息Incorrect login information

某些 Azure Database for MySQL 资源达到了最大限制Maximum limit reached on some Azure Database for MySQL resources

服务的基础结构出现问题Issues with the infrastructure of the service

正在服务中执行维护Maintenance being performed in the service

通过缩放 vCore 数目或移到不同的服务层级更改了服务器的计算资源分配The compute allocation of the server is changed by scaling the number of vCores or moving to a different service tier

通常,Azure Database for MySQL 的连接问题可按如下方式分类:Generally, connection issues to Azure Database for MySQL can be classified as follows:

暂时性错误(短暂或间歇性)Transient errors (short-lived or intermittent)

持久或非暂时性错误(定期重复发生的错误)Persistent or non-transient errors (errors that regularly recur)

对暂时性错误进行故障排除Troubleshoot transient errors

在执行维护、系统遇到硬件或软件错误,或更改服务器的 vCore 数目或服务层级时,会发生暂时性错误。Transient errors occur when maintenance is performed, the system encounters an error with the hardware or software, or you change the vCores or service tier of your server. Azure Database for MySQL 服务具有内置的高可用性,可以自动缓解此类问题。The Azure Database for MySQL service has built-in high availability and is designed to mitigate these types of problems automatically. 但是,应用程序会短暂地与服务器断开连接,通常不会超过 60 秒。However, your application loses its connection to the server for a short period of time of typically less than 60 seconds at most. 某些事件偶尔可能需要更长的时间才能缓解,例如,当某个大型事务导致恢复长时间运行时。Some events can occasionally take longer to mitigate, such as when a large transaction causes a long-running recovery.

解决暂时性连接问题的步骤Steps to resolve transient connectivity issues

查看 Microsoft Azure 服务仪表板以了解应用程序报告错误时出现的任何已知中断。Check the Microsoft Azure Service Dashboard for any known outages that occurred during the time in which the errors were reported by the application.

连接到云服务的应用程序(例如 Azure Database for MySQL)应预料到会发生暂时性错误,并实施重试逻辑来处理这些错误,而不是将它们作为应用程序错误展现给用户。Applications that connect to a cloud service such as Azure Database for MySQL should expect transient errors and implement retry logic to handle these errors instead of surfacing these as application errors to users. Review Handling of transient connectivity errors for Azure Database for MySQL for best practices and design guidelines for handling transient errors.

由于服务器即将达到其资源限制,错误可能看起来像是暂时性连接问题。As a server approaches its resource limits, errors can seem to be transient connectivity issue.

如果连接问题继续存在,或者应用程序发生错误的持续时间超过 60 秒或在特定的一天中看到错误多次发生,请通过在 Azure 支持网站上选择“获取支持”提出 Azure 支持请求。If connectivity problems continue, or if the duration for which your application encounters the error exceeds 60 seconds or if you see multiple occurrences of the error in a given day, file an Azure support request by selecting Get Support on the Azure Support site.

排查一再出现的错误Troubleshoot persistent errors

如果应用程序一直无法连接到 Azure Database for MySQL,通常表示下列其中一项出现了问题:If the application persistently fails to connect to Azure Database for MySQL, it usually indicates an issue with one of the following:

服务器防火墙配置:请确保 Azure Database for MySQL 服务器防火墙配置为允许来自客户端(包括代理服务器和网关)的连接。Server firewall configuration: Make sure that the Azure Database for MySQL server firewall is configured to allow connections from your client, including proxy servers and gateways.

客户端防火墙配置:客户端的防火墙必须允许连接到数据库服务器。Client firewall configuration: The firewall on your client must allow connections to your database server. 不能访问的服务器的 IP 地址和端口以及一些防火墙中的应用程序名称(如 MySQL)必须被允许。IP addresses and ports of the server that you cannot to must be allowed as well as application names such as MySQL in some firewalls.

用户失误:例如,你可能错误键入了连接参数(例如,在连接字符串中键入了服务器名称,或者在用户名中遗漏了 @servername 后缀)。User error: You might have mistyped connection parameters, such as the server name in the connection string or a missing @servername suffix in the user name.

解决永久性连接问题的步骤Steps to resolve persistent connectivity issues

设置防火墙规则以允许客户端 IP 地址。Set up firewall rules to allow the client IP address. (仅出于临时测试目的)使用 0.0.0.0 作为起始 IP 地址,使用 255.255.255.255 作为结束 IP 地址,来设置一个防火墙规则。For temporary testing purposes only, set up a firewall rule using 0.0.0.0 as the starting IP address and using 255.255.255.255 as the ending IP address. 这样会使服务器向所有 IP 地址开放。This will open the server to all IP addresses. 如果这样可以解决连接性问题,请删除此规则,再针对适当限制的 IP 地址或地址范围创建防火墙规则。If this resolves your connectivity issue, remove this rule and create a firewall rule for an appropriately limited IP address or address range.

在客户端与 Internet 之间的所有防火墙上,确保为出站连接打开端口 3306。On all firewalls between the client and the internet, make sure that port 3306 is open for outbound connections.

在仪表板中检查服务运行状况。Check the service health in the dashboard. If you think there's a regional outage, see Overview of business continuity with Azure Database for MySQL for steps to recover to a new region.

后续步骤Next steps

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值