We are using AG DNN for sql server and 2 node are in the same zone ip's are added in cloud dns however while connecting using DNN it always point to first ip in cloud DNS instead of whatever primary instance. if we failover to second instance connection refused. the error is read only status
Hi @Maamer,
Welcome to Google Cloud Community!
For Cloud SQL to allow a failover, the configuration must meet the following requirements:
Note: If both the primary and standby instances are unresponsive, Cloud SQL does not allow failover.
Another possible cause of issue is with the 'binding' of the service to 0.0.0.0, it is when you were to bind a TCP service to the backend IP (which would be incorrect) as stated here: IP addresses for request and return packets
It is also recommended that you check if the guest OS is correct:
Verify that the Google guest agent is running on the backend VM. If you can connect to a healthy backend VM, but you cannot connect to the load balancer, it might be that the Google guest agent (formerly, the Windows Guest Environment or Linux Guest Environment) on the VM is either not running or is unable to communicate with the metadata server (metadata.google.internal, 169.254.169.254). This may also be the cause of your issue. According to this documentation.
For read-only error: this indicates that the client is connecting to a secondary replica, which is configured for read-only access. You can configure an availability group to support read-only routing, which enables its availability group listener to redirect the connection requests of read-intent applications to a readable secondary replica. For more information, see Configure Read-Only Routing for an Availability Group (SQL Server).
For other relevant references:
If the issue persists, kindly reach out to Google Cloud Support for further assistance.
Was this helpful? If so, please accept this answer as “Solution”. If you need additional assistance, reply here within 2 business days and I’ll be happy to help.