【发布时间】: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