linux – 导致此错误的原因:可用性组ag1的指定副本都没有映射到您连接的SQL Server实例
作者:互联网
我按照https://docs.microsoft.com/en-us/sql/linux/sql-server-linux-availability-group-configure-ha为Linux配置永远在线的SQL Server 2017 RC1(14.0.80.90,日期为2017-7-18).此安装使用的是docker镜像,所有这些都在同一个物理主机上.所有步骤都在进行,直到我进入该步骤:
CREATE AVAILABILITY GROUP [ag1]
WITH (DB_FAILOVER = ON, CLUSTER_TYPE = EXTERNAL)
FOR REPLICA ON
N'always-onA'
WITH (
ENDPOINT_URL = N'tcp://always-onA:5022',
AVAILABILITY_MODE = SYNCHRONOUS_COMMIT,
FAILOVER_MODE = EXTERNAL,
SEEDING_MODE = AUTOMATIC
),
N'always-onB'
WITH (
ENDPOINT_URL = N'tcp://always-onB:5022',
AVAILABILITY_MODE = SYNCHRONOUS_COMMIT,
FAILOVER_MODE = EXTERNAL,
SEEDING_MODE = AUTOMATIC
),
N'always-onC'
WITH(
ENDPOINT_URL = N'tcp://always-onC:5022',
AVAILABILITY_MODE = SYNCHRONOUS_COMMIT,
FAILOVER_MODE = EXTERNAL,
SEEDING_MODE = AUTOMATIC
);
我收到错误消息:
Msg 35237, Level 16, State 1, Line 2
None of the specified replicas for availability group ag1 maps to the instance of SQL Server to which you are connected. Reenter the command, specifying this server instance to host one of the replicas. This replica will be the initial primary replica.
我已经在https://docs.microsoft.com/en-us/sql/linux/sql-server-linux-release-notes查看了发行说明,以确保没有已知问题,并且此时应支持此功能.
在每个docker容器中,名称“always-onX”解析:
> root@5194403487fe:/# ping always-onA
> PING always-onA (172.17.0.10): 56 data bytes
> 64 bytes from 172.17.0.10: icmp_seq=0 ttl=64 time=0.125 ms
> ^C--- always-onA ping statistics ---
> 1 packets transmitted, 1 packets received, 0% packet loss
> round-trip min/avg/max/stddev = 0.125/0.125/0.125/0.000 ms
> root@5194403487fe:/# ping always-onB
> PING always-onB (172.17.0.11): 56 data bytes
> 64 bytes from 172.17.0.11: icmp_seq=0 ttl=64 time=0.156 ms
> ^C--- always-onB ping statistics ---
> 1 packets transmitted, 1 packets received, 0% packet loss
> round-trip min/avg/max/stddev = 0.156/0.156/0.156/0.000 ms
> root@5194403487fe:/# ping always-onC
> PING always-onC (172.17.0.12): 56 data bytes
> 64 bytes from 172.17.0.12: icmp_seq=0 ttl=64 time=0.308 ms
> ^C--- always-onC ping statistics ---
> 1 packets transmitted, 1 packets received, 0% packet loss
> round-trip min/avg/max/stddev = 0.308/0.308/0.308/0.000 ms
SQL Server还在每个实例上侦听端口5022(这对所有实例都显示相同):
# netstat -alnp | grep 5022
tcp 0 0 0.0.0.0:5022 0.0.0.0:* LISTEN 9/sqlservr
此外,系统上不存在可能导致混淆的其他IP:
# ifconfig
eth0 Link encap:Ethernet HWaddr 02:42:ac:11:00:0a
inet addr:172.17.0.10 Bcast:0.0.0.0 Mask:255.255.0.0
inet6 addr: fe80::42:acff:fe11:a/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:4058 errors:0 dropped:0 overruns:0 frame:0
TX packets:2016 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:2771303 (2.7 MB) TX bytes:241070 (241.0 KB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:470 errors:0 dropped:0 overruns:0 frame:0
TX packets:470 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1870657 (1.8 MB) TX bytes:1870657 (1.8 MB)
名称always-onA / B / C在docker映像的主机文件中解析,并通过DNS解析,因此不存在任何问题:
# nslookup always-onA
Server: 192.168.1.1
Address: 192.168.1.1#53
Name: always-onA
Address: 172.17.0.10
最后,SQL Server日志显示镜像端点正在侦听连接:
# docker logs always-onA | tail -2
2017-07-23 16:53:27.76 spid56 Server is listening on [ 0.0.0.0 <ipv4> 5022].
2017-07-23 16:53:27.76 spid56 The Database Mirroring endpoint is now listening for connections.
似乎SQL服务器无法清楚地识别可用性组中的一个配置节点实际上是自身,因而得到错误,但我没有看到任何方法来调试它.我尝试使用以下代替名称“always-onA”:
始终ONA
127.0.0.1
本地主机
0.0.0.0
错误总是一样的.寻找有关如何解决此问题的任何想法.
解决方法:
已解决:问题是在创建可用性组时,节点说明符(即N’name’)需要使用根据“hostname”命令返回的EXACT名称.使用任何其他标识符,即使它解析为正确的IP,似乎也不起作用.
标签:sql-server-2017,linux,availability-groups 来源: https://codeday.me/bug/20190806/1597182.html