MS-SQL 连接(来自 kubernetes)的 IP 和实例名称不起作用;端口正常工作

MS-SQL 连接(来自 kubernetes)的 IP 和实例名称不起作用;端口正常工作

情况:

MS-SQL 服务器 <--> 本地网络 <-- VPN --> Google Kubernetes <--> Pod (sql-client)

  • 我们的本地网络通过 VPN 连接到我们的 Google Kubernetes 集群
  • ms-sql 服务器正在我们的本地网络中运行
  • 一个 pod 尝试打开此 ms-sql 服务器的一个实例

问题:

我无法通过tcp:IP\实例名称。我尝试了所有可能的拼写变体形式(\、\、/、//、/、...)

但如果我尝试通过tcp:IP,端口,它正在运行。目前我无法将服务器配置为使用静态端口。这意味着我需要一个带有实例名称的解决方案。

错误信息

root@mssql-tools-598c45d8bb-8x744:/# sqlcmd -S tcp:10.10.1.123\\DEV -U user -P password -d my_db
Sqlcmd: Error: Microsoft ODBC Driver 13 for SQL Server : Login timeout expired.
Sqlcmd: Error: Microsoft ODBC Driver 13 for SQL Server : MAX_PROVS: Error Locating Server/Instance Specified [xFFFFFFFF]. .
Sqlcmd: Error: Microsoft ODBC Driver 13 for SQL Server : A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online..

root@mssql-tools-598c45d8bb-8x744:/# sqlcmd -S tcp:10.10.1.123\DEV -U user -P password -d my_db
Sqlcmd: Error: Microsoft ODBC Driver 13 for SQL Server : Login timeout expired.
Sqlcmd: Error: Microsoft ODBC Driver 13 for SQL Server : TCP Provider: Error code 0x2AF9.
Sqlcmd: Error: Microsoft ODBC Driver 13 for SQL Server : A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online..

笔记:

  • 我们用 wireshark 捕获了网络流量。在尝试通过 instance-name 建立连接时,我们能够看到客户端和服务器正确交换了端口。但此后,客户端发送了一个带有ACK:真且 Fin:真(此后连接立即关闭)
  • 连接字符串在 Windows PC 上运行
  • 这是用于测试的容器映像:https://hub.docker.com/_/microsoft-mssql-tools

相关内容