0

I have two instance of SQL Server running as AlwaysOn primary - replica. Now I want to setup connect reading database in replica. I have just setup my SQL Servers following this instruction: https://blogs.msdn.microsoft.com/alwaysonpro/2013/07/01/end-to-end-using-a-listener-to-connect-to-a-secondary-replica-read-only-routing/.

Now everything is ok. But I can access SQL Server by using Listener address from external if I don't use parameter readonly. In internal network it's ok

External network

sqlcmd -S <IP Listerner> -U <username> -P <password> -d <db name> -K readonly --> not connect
sqlcmd -S <IP Listerner> -U <username> -P <password> -d <db name> --> connected

Internal network

sqlcmd -S <IP Listerner> -U <username> -P <password> -d <db name> -K readonly --> connected
sqlcmd -S <IP Listerner> -U <username> -P <password> -d <db name> --> connected
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459

2 Answers2

0

It could be that the firewall is blocking certain ports. Make sure that port 5022 (the default port) and the port used for the listener are opened in the firewall.

g00glen00b
  • 41,995
  • 13
  • 95
  • 133
0

I got the same problem and solved.

External network only know your ListenerName on primary node. All you need to do is that let External network know your all your nodes.

Change your host file in your external network server like this.

  • 192.168.1.1 node1.yourdomain
  • 192.168.1.2 node2.yourdomain
Nishan
  • 3,644
  • 1
  • 32
  • 41