Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


AlwaysOn: Client (Re)Connecting to wrong server after fail-over?


AlwaysOn: Client (Re)Connecting to wrong server after fail-over?

Author
Message
ffoerster
ffoerster
SSC Journeyman
SSC Journeyman (76 reputation)SSC Journeyman (76 reputation)SSC Journeyman (76 reputation)SSC Journeyman (76 reputation)SSC Journeyman (76 reputation)SSC Journeyman (76 reputation)SSC Journeyman (76 reputation)SSC Journeyman (76 reputation)

Group: General Forum Members
Points: 76 Visits: 257
Hi, I hope someone can point me into the right direction.

We have a AlwaysOn HADR setup with 2 servers, one primary and one secondary replica for a couple of databases. Synchronous Commit, Automatic Failover, Readable Secondary defined, No ReadOnly Routing.
SQL-01, *.*.*.240
SQL-02, *.*.*.241
-> AG Listener: SQL, IP *.*.*.229

An application recently started behaving weird when a fail-over from one server to the other occurs. It seems to be re-connecting to the wrong (now secondary) server and thus will see an appropriate error message (DB is readonly) upon writing attempts.

At the time of fail-over the application sees the following error message:
"Unable to access database 'Execution' because its replica role is RESOLVING which does not allow connections. Try the operation again later."

-> this is expected,

a few (~10) seconds later the same application gets the following error
"The target database ('Execution') is in an availability group and is currently accessible for connections when the application intent is set to read only."
or the one that the target database is read-only

I have checked the connection string of the application. It is using the AG listener DNS name [SQL], and [SQL] is always resolved to IP *.*.*.229

Now I am wondering why the application hangs on to the wrong server?

Kind regards, Frank
Perry Whittle
Perry Whittle
SSCrazy Eights
SSCrazy Eights (8.8K reputation)SSCrazy Eights (8.8K reputation)SSCrazy Eights (8.8K reputation)SSCrazy Eights (8.8K reputation)SSCrazy Eights (8.8K reputation)SSCrazy Eights (8.8K reputation)SSCrazy Eights (8.8K reputation)SSCrazy Eights (8.8K reputation)

Group: General Forum Members
Points: 8784 Visits: 16558
What does the AlwaysOn groups read only routing url config look like, specifically the url order for each replica when in the primary role

-----------------------------------------------------------------------------------------------------------

"Ya can't make an omelette without breaking just a few eggs" ;-)
ffoerster
ffoerster
SSC Journeyman
SSC Journeyman (76 reputation)SSC Journeyman (76 reputation)SSC Journeyman (76 reputation)SSC Journeyman (76 reputation)SSC Journeyman (76 reputation)SSC Journeyman (76 reputation)SSC Journeyman (76 reputation)SSC Journeyman (76 reputation)

Group: General Forum Members
Points: 76 Visits: 257
Replica SecondaryRoleConnections ReadonlyRoutingUrl
[SQL-01] READ_ONLY tcp://SQL-01.MKT.LOCAL:1433
[SQL-02] ALL {NULL}

sys.availability_read_only_routing_lists contains (only) 1 record
replica_id routing_priority read_only_replica_id
SQL-01 1 SQL-01

(replaced the GUID with the replica name)

Does that help?
Thanks, Frank
Perry Whittle
Perry Whittle
SSCrazy Eights
SSCrazy Eights (8.8K reputation)SSCrazy Eights (8.8K reputation)SSCrazy Eights (8.8K reputation)SSCrazy Eights (8.8K reputation)SSCrazy Eights (8.8K reputation)SSCrazy Eights (8.8K reputation)SSCrazy Eights (8.8K reputation)SSCrazy Eights (8.8K reputation)

Group: General Forum Members
Points: 8784 Visits: 16558
Doh, sorry didnt see this

ffoerster (5/6/2014)
No ReadOnly Routing.


Have you double checked the connection string, are you using std TCP port or non std?
Was this an automatic failover or a manual failover?


Could you check the results of the following please

select   replica_server_name, 
availability_mode_desc,
failover_mode_desc,
primary_role_allow_connections_desc,
secondary_role_allow_connections_desc
from [sys].[availability_replicas]



-----------------------------------------------------------------------------------------------------------

"Ya can't make an omelette without breaking just a few eggs" ;-)
ffoerster
ffoerster
SSC Journeyman
SSC Journeyman (76 reputation)SSC Journeyman (76 reputation)SSC Journeyman (76 reputation)SSC Journeyman (76 reputation)SSC Journeyman (76 reputation)SSC Journeyman (76 reputation)SSC Journeyman (76 reputation)SSC Journeyman (76 reputation)

Group: General Forum Members
Points: 76 Visits: 257
Just completed my response but posting resulted in an "error" here on the board. Sad
Will type it together again, may take some minutes though
Frank
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search