SqlServer mirroring failover on fargate

Noel Mc Grath 1 Reputation point
2021-07-09T15:16:01.657+00:00

We have a simple .NET 5 console app deployed in a Docker container. The app connects to SQL Server and does a simple SELECT * periodically (via Microsoft.Data.SqlClient.dll). The app is deployed in a cluster on Fargate (ECS). SQL Server is a mirrored setup, configured for automatic failover.

When we perform a manual failover of the database, a connection cannot be established to the database failover partner for some reason, and the application throws exceptions (System.Exception Cannot connect to SQL Server Browser. Ensure SQL Server Browser has been started). We have verified that SQL Server Browser is started, and all necessary protocols/ports are opened to allow network traffic to and from the database.

We have tried running this app/Docker container on an Amazon Linux 2 EC2 instance (which we assume is the underlying EC2 instance on top of which Fargate tasks run), and we have observed the same behaviour. However, we have also tried running this app/Docker container on a Ubuntu 18.04 EC2 instance, and we do not observe any errors - the app instantly connects to the database failover partner following a manual failover. Thus this appears to possibly be an issue with the underlying host OS.

Any help with this would be greatly appreciated.

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
12,714 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,248 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Cris Zhan-MSFT 6,601 Reputation points
    2021-07-12T03:11:40.25+00:00

    Hi,
    Welcome to Microsoft Q&A!

    May I know the connection string used to connect SQL Server?
    Please show the complete error message received when the connection fails.

    >However, we have also tried running this app/Docker container on a Ubuntu 18.04 EC2 instance, and we do not observe any errors

    Since the failover partner can be successfully connected in this environment, this may not be a problem from the SQL Server side.

    0 comments No comments