【问题标题】:mySQL connection times out on Windows AzureWindows Azure 上的 mySQL 连接超时
【发布时间】:2011-02-01 16:39:14
【问题描述】:

我们有一个与多个第 3 方系统集成的 Windows Azure 应用程序(Lokad.CQRS 架构)。其中一种集成发生在 mySQL 上。一切都很顺利,但最近我们有一个 mySQL 数据库,Windows Azure 应用程序无法连接,导致超时。

这是相关的堆栈跟踪:

System.TimeoutException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond ---> 
System.IO.IOException: Unable to read data from the transport connection: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. --->
System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
--- End of inner exception stack trace ---
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
at MyNetworkStream.Read(Byte[] buffer, Int32 offset, Int32 count)
--- End of inner exception stack trace ---
at MyNetworkStream.HandleOrRethrowException(Exception e)
at MyNetworkStream.Read(Byte[] buffer, Int32 offset, Int32 count)
at MySql.Data.MySqlClient.TimedStream.Read(Byte[] buffer, Int32 offset, Int32 count)
at System.IO.BufferedStream.Read(Byte[] array, Int32 offset, Int32 count)
at MySql.Data.MySqlClient.MySqlStream.ReadFully(Stream stream, Byte[] buffer, Int32  offset, Int32 count)
at MySql.Data.MySqlClient.MySqlStream.LoadPacket()
at MySql.Data.MySqlClient.MySqlStream.ReadPacket()
at MySql.Data.MySqlClient.NativeDriver.Open()
at MySql.Data.MySqlClient.Driver.Open()
at MySql.Data.MySqlClient.Driver.Create(MySqlConnectionStringBuilder settings)
at MySql.Data.MySqlClient.MySqlConnection.Open()

重要亮点:

  • 可从 Windows Azure 访问目标数据库(通过 MySQL Workbench 连接时使用端口转发进行验证);
  • 与目标数据库的集成可以在本地 Azure Dev Fabric 中正常工作;
  • Windows Azure 上的问题发生在展位池连接和非池连接。
  • TCP/IP,普通端口,无 SSL;
  • 此操作的连接超时时间足够大 - 5 秒,并且连续失败(但总是在距离 NE DC 不远的非 Azure 机器上成功)

我们有 Oracle、MS SQL、mySQL 和 PostgreSQL 连接,通过 Lokad.CQRS 在 Windows Azure 上以各种设置和配置(Linux/Windows 托管的数据库服务器)工作。但是这个特定的 mySQL 案例完全让我感到困惑。

对可能导致问题的原因有任何猜测吗?

【问题讨论】:

  • 您说您使用端口转发来确保 Azure 可以通话。您是否尝试过直接从角色连接?也许使用 RDP 并验证?
  • 端口转发(TCP 隧道)由我们自己的 Lokad.CQRS 服务器维护。所以如果隧道可以访问,那么服务器肯定可以访问。问题可能在于 Azure Fabric 以某种方式为此连接增加了显着延迟,从而破坏了服务器端超时。有关详细信息,请参阅我自己的答案。

标签: .net mysql azure azure-worker-roles lokad-cqrs


【解决方案1】:

解决方案:

由于某种原因,Azure Production Fabric 为连接到目标数据库增加了太多延迟,它总是超时。来自欧洲附近机器的相同连接从未中断连接超时。

将这个特定案例的连接超时时间增加(5 倍)确实解决了这个问题,而不会给分布式系统的其余部分增加太多风险。

问题可能出在 NE DC 的网络配置、路由器故障等。

【讨论】:

    【解决方案2】:

    我只是想问你一堆问题,因为我们想跟踪这个问题并帮助确保我们在 Windows Azure 上运行的 oss 应用程序没有问题。如果您没有看到,请告诉我。

    贾斯·桑杜,@jassand 互操作性战略团队 http://interoperabilitybridges.com http://blogs.msdn.com/interoperability

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-04-08
      • 1970-01-01
      • 1970-01-01
      • 2015-10-19
      • 2012-12-19
      相关资源
      最近更新 更多