Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

AlwaysOn: Client (Re)Connecting to wrong server after fail-over? Expand / Collapse
Author
Message
Posted Tuesday, May 6, 2014 4:36 PM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Tuesday, October 7, 2014 1:35 PM
Points: 73, Visits: 195
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
Post #1568221
Posted Tuesday, May 6, 2014 4:57 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 3:54 PM
Points: 6,462, Visits: 13,909
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"
Post #1568235
Posted Wednesday, May 7, 2014 12:35 PM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Tuesday, October 7, 2014 1:35 PM
Points: 73, Visits: 195

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
Post #1568649
Posted Thursday, May 8, 2014 9:16 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 3:54 PM
Points: 6,462, Visits: 13,909
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"
Post #1568970
Posted Thursday, May 8, 2014 10:43 AM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Tuesday, October 7, 2014 1:35 PM
Points: 73, Visits: 195
Just completed my response but posting resulted in an "error" here on the board.
Will type it together again, may take some minutes though
Frank
Post #1569018
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse