Configure Availability Group to Communicate on a Dedicated Network

Published Jan 15 2019 03:22 PM 820 Views
Microsoft
First published on MSDN on Nov 01, 2013

SQL Server 2012 AlwaysOn Availability Groups uses a database mirroring endpoint for each SQL Server instance that hosts an availability group replica. The endpoint is used to communicate between the primary and the secondary replicas of the availability group.


If a second NIC is installed on the primary replica and secondary replica of an availability group, that availability group can be configured to replicate mirrored changes over the private network, isolating the availability group traffic. This cannot be configured completely in SQL Server Management Studio, therefore, this blog describes this process.


Scenario


Say you have the following two SQL Severs defined on two networks and wish to dedicate the private network (10.10.1.x) for availability group communication between SQLNODE1 (Primary) to SQLNODE2 (Secondary).


SQLNODE1
Public = 10.8.0.20
Private = 10.10.1.20


SQLNODE2
Public = 10.8.0.21
Private = 10.10.1.21


Configure endpoints to listen on private nic


First, the endpoints on SQLNODE1 and SQLNODE2 must be configured to listen for traffic on port 5022 and network 10.10.1.x:


:CONNECT SQLNODE1
CREATE ENDPOINT [Hadr_endpoint]
AS TCP (LISTENER_PORT = 5022, LISTENER_IP = (10.10.1.20))
FOR DATA_MIRRORING (ROLE = ALL, ENCRYPTION = REQUIRED ALGORITHM AES);
GO


:CONNECT SQLNODE2
CREATE ENDPOINT [Hadr_endpoint]
AS TCP (LISTENER_PORT = 5022, LISTENER_IP = (10.10.1.21))
FOR DATA_MIRRORING (ROLE = ALL, ENCRYPTION = REQUIRED ALGORITHM AES);
GO


Create availability group to connect to private nics


When creating your availability group, specify the IP addresses in network 10.10.2.x to connect to each server:


:CONNECT SQLNODE1
CREATE AVAILABILITY GROUP [AG]
WITH (AUTOMATED_BACKUP_PREFERENCE = SECONDARY)
FOR DATABASE [AGDB]
REPLICA ON N'SQLNODE1' WITH (ENDPOINT_URL = N'TCP://10.10.1.20:5022', FAILOVER_MODE = AUTOMATIC, AVAILABILITY_MODE = SYNCHRONOUS_COMMIT, BACKUP_PRIORITY = 50, SECONDARY_ROLE(ALLOW_CONNECTIONS = NO)),
N'SQLNODE2' WITH (ENDPOINT_URL = N'TCP://10.10.1.21:5022', FAILOVER_MODE = AUTOMATIC, AVAILABILITY_MODE = SYNCHRONOUS_COMMIT, BACKUP_PRIORITY = 50, SECONDARY_ROLE(ALLOW_CONNECTIONS = NO));


%3CLINGO-SUB%20id%3D%22lingo-sub-317914%22%20slang%3D%22en-US%22%3EConfigure%20Availability%20Group%20to%20Communicate%20on%20a%20Dedicated%20Network%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-317914%22%20slang%3D%22en-US%22%3E%0A%20%26lt%3Bmeta%20http-equiv%3D%22Content-Type%22%20content%3D%22text%2Fhtml%3B%20charset%3DUTF-8%22%20%2F%26gt%3B%3CSTRONG%3E%20First%20published%20on%20MSDN%20on%20Nov%2001%2C%202013%20%3C%2FSTRONG%3E%20%3CBR%20%2F%3E%3CP%3ESQL%20Server%202012%20AlwaysOn%20Availability%20Groups%20uses%20a%20database%20mirroring%20endpoint%20for%20each%20SQL%20Server%20instance%20that%20hosts%20an%20availability%20group%20replica.%20The%20endpoint%20is%20used%20to%26nbsp%3Bcommunicate%20between%20the%20primary%20and%20the%20secondary%20replicas%20of%20the%20availability%20group.%3C%2FP%3E%3CBR%20%2F%3E%3CP%3EIf%20a%20second%20NIC%20is%20installed%20on%20the%20primary%20replica%20and%20secondary%20replica%20of%20an%20availability%20group%2C%20that%20availability%20group%20can%20be%20configured%20to%20replicate%20mirrored%20changes%20over%20the%20private%20network%2C%20isolating%20the%20availability%20group%20traffic.%20This%20cannot%20be%20configured%20completely%20in%20SQL%20Server%20Management%20Studio%2C%20therefore%2C%20this%20blog%20describes%20this%20process.%3C%2FP%3E%3CBR%20%2F%3E%3CH3%20id%3D%22toc-hId-1477837538%22%20id%3D%22toc-hId-1232144178%22%3EScenario%3C%2FH3%3E%3CBR%20%2F%3E%3CP%3ESay%20you%20have%20the%20following%20two%20SQL%20Severs%20defined%20on%20two%20networks%20and%20wish%20to%20dedicate%20the%20private%20network%20(10.10.1.x)%26nbsp%3Bfor%20availability%20group%20communication%20between%20SQLNODE1%20(Primary)%20to%20SQLNODE2%20(Secondary).%3C%2FP%3E%3CBR%20%2F%3E%3CP%3ESQLNODE1%20%3CBR%20%2F%3E%20Public%20%3D%2010.8.0.20%20%3CBR%20%2F%3E%20Private%20%3D%2010.10.1.20%3C%2FP%3E%3CBR%20%2F%3E%3CP%3ESQLNODE2%20%3CBR%20%2F%3E%20Public%20%3D%2010.8.0.21%20%3CBR%20%2F%3E%20Private%20%3D%2010.10.1.21%3C%2FP%3E%3CBR%20%2F%3E%3CH3%20id%3D%22toc-hId--1074319423%22%20id%3D%22toc-hId--575310285%22%3EConfigure%20endpoints%20to%26nbsp%3Blisten%20on%26nbsp%3Bprivate%20nic%3C%2FH3%3E%3CBR%20%2F%3E%3CP%3EFirst%2C%20the%20endpoints%20on%20SQLNODE1%20and%20SQLNODE2%20must%20be%20configured%20to%20listen%20for%20traffic%20on%20port%205022%20and%20network%2010.10.1.x%3A%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%3ACONNECT%20SQLNODE1%20%3CBR%20%2F%3E%20CREATE%20ENDPOINT%20%5BHadr_endpoint%5D%20%3CBR%20%2F%3E%20AS%20TCP%20(LISTENER_PORT%20%3D%205022%2C%20LISTENER_IP%20%3D%20(10.10.1.20))%20%3CBR%20%2F%3E%20FOR%20DATA_MIRRORING%20(ROLE%20%3D%20ALL%2C%20ENCRYPTION%20%3D%20REQUIRED%20ALGORITHM%20AES)%3B%20%3CBR%20%2F%3E%20GO%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3ACONNECT%20SQLNODE2%20%3CBR%20%2F%3E%20CREATE%20ENDPOINT%20%5BHadr_endpoint%5D%20%3CBR%20%2F%3E%20AS%20TCP%20(LISTENER_PORT%20%3D%205022%2C%20LISTENER_IP%20%3D%20(10.10.1.21))%20%3CBR%20%2F%3E%20FOR%20DATA_MIRRORING%20(ROLE%20%3D%20ALL%2C%20ENCRYPTION%20%3D%20REQUIRED%20ALGORITHM%20AES)%3B%20%3CBR%20%2F%3E%20GO%3C%2FP%3E%3CBR%20%2F%3E%3CH3%20id%3D%22toc-hId-668490912%22%20id%3D%22toc-hId-1912202548%22%3ECreate%20availability%20group%20to%20connect%20to%20private%20nics%3C%2FH3%3E%3CBR%20%2F%3E%3CP%3EWhen%20creating%20your%20availability%20group%2C%20specify%20the%20IP%20addresses%20in%20network%2010.10.2.x%20to%20connect%20to%20each%20server%3A%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%3ACONNECT%20SQLNODE1%20%3CBR%20%2F%3E%20CREATE%20AVAILABILITY%20GROUP%20%5BAG%5D%20%3CBR%20%2F%3E%20WITH%20(AUTOMATED_BACKUP_PREFERENCE%20%3D%20SECONDARY)%20%3CBR%20%2F%3E%20FOR%20DATABASE%20%5BAGDB%5D%20%3CBR%20%2F%3E%20REPLICA%20ON%20N'SQLNODE1'%20WITH%20(ENDPOINT_URL%20%3D%20N'TCP%3A%2F%2F10.10.1.20%3A5022'%2C%20FAILOVER_MODE%20%3D%20AUTOMATIC%2C%20AVAILABILITY_MODE%20%3D%20SYNCHRONOUS_COMMIT%2C%20BACKUP_PRIORITY%20%3D%2050%2C%20SECONDARY_ROLE(ALLOW_CONNECTIONS%20%3D%20NO))%2C%20%3CBR%20%2F%3E%20N'SQLNODE2'%20WITH%20(ENDPOINT_URL%20%3D%20N'TCP%3A%2F%2F10.10.1.21%3A5022'%2C%20FAILOVER_MODE%20%3D%20AUTOMATIC%2C%20AVAILABILITY_MODE%20%3D%20SYNCHRONOUS_COMMIT%2C%20BACKUP_PRIORITY%20%3D%2050%2C%20SECONDARY_ROLE(ALLOW_CONNECTIONS%20%3D%20NO))%3B%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%3C%2FP%3E%0A%20%0A%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-317914%22%20slang%3D%22en-US%22%3EFirst%20published%20on%20MSDN%20on%20Nov%2001%2C%202013%20SQL%20Server%202012%20AlwaysOn%20Availability%20Groups%20uses%20a%20database%20mirroring%20endpoint%20for%20each%20SQL%20Server%20instance%20that%20hosts%20an%20availability%20group%20replica.%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-317914%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EHigh%20Availability%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Version history
Last update:
‎Jan 15 2019 03:22 PM
Updated by: