Sql-server – Setting up AG listeners

availability-groupssql server

I am relatively knew to MSSQL so please bare with me.

My infrastructure is currently in AWS.

I have 3 servers running MSSQL. I have a primary replica and two secondary replicas. All three servers are in 1 AG group and there is 1 database being replicated.

Server 1 is in AZ A (Subnet A)

Server 2 is in AZ A (Subnet A)

Server 3 is in AZ B (Subnet B)

All are set for automatic sync failover. I am working on adding a listen for these 3 replicas.

As far as I can tell you can only add a static listener with the two different subnets.

So lets say I add an IP for Server 1 and Server 3. It wont let me add it for Server 2 because its 1 per subnet.

How would this work. Am i missing something here? Am I doing something wrong?

Best Answer

How would this work. Am i missing something here? Am I doing something wrong?

You don't need another IP for Server 2 because it is in the same subnet as Server 1. Your listener requires 1 valid IP address for each subnet that a cluster node is in. In your case, you have 3 servers, but only 2 subnets so you only need 2 IP addresses for the listener.

Only one IP is ever 'active' for the listener so even if the AG fails over from Server 1 to Server 2, the IP address for the listener will stay the same, but Server 2 will begin listening on that IP.