Quantcast
Channel: SQL Server High Availability and Disaster Recovery forum
Viewing all articles
Browse latest Browse all 4689

Readonly routing not working in azure alwayson availability

$
0
0

Hi,

We have configured Always on availability in Azure environment within same data center along with listener configuration.

Have done below changes to direct readonly queries to secondary DB which is set to read-intent true

--SQL1 is primary and SQL2 is secondary
--Setting for SQL1
ALTER AVAILABILITY GROUP [AGName]
 MODIFY REPLICA ON
N'SQL2' WITH
(SECONDARY_ROLE (ALLOW_CONNECTIONS = READ_ONLY));

ALTER AVAILABILITY GROUP [AGName]
 MODIFY REPLICA ON
N'SQL2' WITH
(SECONDARY_ROLE (READ_ONLY_ROUTING_URL = N'TCP://SQL2.corp.contoso.com:1433'));

--Setting for SQL2
ALTER AVAILABILITY GROUP [AGName]
 MODIFY REPLICA ON
N'SQL1' WITH
(SECONDARY_ROLE (ALLOW_CONNECTIONS = READ_ONLY));

ALTER AVAILABILITY GROUP [AGName]
 MODIFY REPLICA ON
N'SQL1' WITH
(SECONDARY_ROLE (READ_ONLY_ROUTING_URL = N'TCP://SQL1.corp.contoso.com:1433'));

--Setting read only routing list for SQL1 for read only connection
ALTER AVAILABILITY GROUP [AGName]
MODIFY REPLICA ON
N'SQL1' WITH
(PRIMARY_ROLE (READ_ONLY_ROUTING_LIST = ('SQL2','SQL1')));

Connection string was appended with Read intent true:
Server=tcp:<listenername,port>;Database=<DB>;user id=<User>;password=<password>;ApplicationIntent=ReadOnly;MultiSubnetFailover=True

Able to see that priority list being reflected in sys.availability_read_only_routing_lists

But getting network instance not found error on trying to connect with above connection string.

Connection is working fine by removing "ApplicationIntent=ReadOnly"

Also, connection is working fine if i remove SQL2 from Routinglist as below,

ALTER AVAILABILITY GROUP [AGName]
MODIFY REPLICA ON
N'SQL1' WITH
(PRIMARY_ROLE (READ_ONLY_ROUTING_LIST = ('SQL1')));

We verified that SQL2 is up and running

Also, we will requiring a similar set up for multi sub net or across Datacenter setup is that possible?


Viewing all articles
Browse latest Browse all 4689

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>