Sql-server – Connection AlwaysOn AG Listener Problem

active-directoryavailability-groupsconnectivitysql serversql server 2014

I'm a newbie for microsoft technologies and I'm having problems in connectivity part for SQL Server 2014. This is probably an easy issue but I'm stuck.

I've 4 servers. One of them is the Active Directory Domain Controller, one is the application server and the others are being used for SQL Servers. Since it's a connectivity issue, IP's for servers are;
-AD DC : 10.6.0.100 ( Also the DNS Server )
-APP : 10.6.0.110
-SQL 1 : 10.6.0.120
-SQL 2 : 10.6.0.121

I've successfully created a failover cluster (DBCLUSTER) and set the IP address of the FC as 10.6.0.130 ( which is not an actual server IP, I really don't get this part.. ).

Later, I've created an AlwaysOn Availability Group for sql servers. I've successfully created the AG without listener. I could connect to servers from each other, database syncs without problem. Then, I've created a listener (AG-LISTENER) and set it's ip as 10.6.0.131 ( which is not an actual server IP, again? ) and set it's port to 5525. It gave no problems.

So I wanted to test connectivity. When I wanted to make connections from APP server to directly SQL 1 or SQL 2, I can connect without problem. But when I try to connect to AG-LISTENER, it cannot find it on network. When I check the DNS records. I can see it as it's being hosted on 10.6.0.131.

When I tried to ping to AG-LISTENER from AD-DC, APP, SQL 2 servers, it responds that the destination host is unreachable (it's pinging 10.6.0.131 but the response comes from the IP's of AD-DC, APP and SQL 2 servers). It can connect from SQL 1 server, which is the primary for AG.

I've checked the firewalls, there's no problem. But I think this is an network issue which I have no clue.

PS: Servers are operating on Windows Server 2012 and are not being hosted on Azure.

SOLUTION

Cause of the problem was the network topology of the service provider. It's found that IP's 10.6.0.0/32 could be used by other servers of other customers. So they've allocated us another IP block which only we have access to and it worked like a charm.

Best Answer

It can connect from SQL 1 server, which is the primary for AG.

By "connect", do you mean it can ping AG-LISTENER from SQL1?

It sounds like what your problem might be is with the port number you chose for your listener. By choosing 5525, you are selecting a non-default port (1433 would be the default).

So when you try to connect to the listener, what does your connection string look like? I'm guessing it looks something like this:

data source = ag-listener; initial catalog = ...

You have two options here. You can either be explicit with your listener's port number:

data source = ag-listener,5525; initial catalog = ...

Likewise, if you're testing this out with SQL Server Management Studio (SSMS), then for the Connect to Server dialog box, instead of putting in ag-listener for the Server name text box, put in ag-listener,5525.

Or you can change the port that your listener is listening on to 1433 (read the below BOL reference before considering this change):

alter availability group YourAvailabilityGroupName
modify listener 'AG-LISTENER'
(
    port = 1433
);

It is worth noting when you can use the default port (1433). Take a look at this reference on BOL explaining when you can and can't use 1433 for the listener (excerpt copy/pasted below for reference):

You can configure the default port to 1433 in order to allow for simplicity of the client connection strings. If using 1433, you do not need to designate a port number in a connection string. Also, since each availability group listener will have a separate virtual network name, each availability group listener configured on a single WSFC can be configured to reference the same default port of 1433.

(portions omitted for brevity)

If you use the default port of 1433 for availability group listener VNNs, you will still need to ensure that no other services on the cluster node are using this port; otherwise this would cause a port conflict.

EDIT: If the above isn't your problem (as seen from your comment below) then, after you look through the logs, I'd say the next best course of action is to start looking at the network traffic to see what is (and isn't) happening. You can use a network monitoring tool like netmon to accomplish this.

Another thing I'd do, and I realize you said the firewall isn't a problem, but I'd see if the port is actually listening (my favorite tool for this is portqry).