使用NHibernate的.Net Application驱动程序以支持AWS Aurora的故障转移功能 [英] Driver for .Net Application using NHibernate to support failover functionality of AWS Aurora

查看:112
本文介绍了使用NHibernate的.Net Application驱动程序以支持AWS Aurora的故障转移功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将数据库从MSSQL迁移到Aurora(MYSQL).该应用程序正在使用.net和NHibernate.我们为MYSQL"MySql.Data"尝试了Nhibernate驱动程序,该驱动程序适用于所有使用情况,但故障转移也不错.当发生故障转移时,连接不会重置,并且会继续尝试从写入器群集连接到旧IP,因此所有写入调用都会失败,但例外情况是"MySQL服务器正在运行--read-- only选项,因此它无法执行此语句".只有在Web服务器上执行IISRESET后才能解决此问题.

I am migrating my Database from MSSQL to Aurora(MYSQL). The application is using .net and NHibernate. We tried the Nhibernate driver for MYSQL "MySql.Data" and it works fine for all use cases but failover. When a failover happens, the connection is not reset and it keeps trying to connect to the old IP from the writer cluster and so all the write call fails with the exception "The MySQL server is running with the --read-- only option so it cannot execute this statement". This only gets resolved after doing an IISRESET on the web servers.

我知道对于Java,MariaDB连接器能够处理此用例. .net应用程序是否有类似的驱动程序可用? 处理此类用例的最佳实践是什么?

I know that for java, the MariaDB connector is able to take care of this use case. Is there any similar driver available for .net applications? What is the best practice to handle such use case?

推荐答案

MariaDB Java连接器具有Aurora的特定实现.我对.net没有任何了解. 仍然正常的解决方案是使用群集DNS:Aurora提供了不同的DNS链接:

MariaDB java connector has a specific implementation for Aurora. There is none that i know for .net. Still the normal solution is using cluster DNS : Aurora provide different DNS link:

  • 每个实例一个
  • 集群端点(例如xxx.cluster-yyy.zzz.rds.amazonaws.com)
  • 阅读器端点(负载均衡)(例如xxx.cluster-ro-yyy.zzz.rds.amazonaws.com)

使用集群端点,您正在使用当前编写器实例.进行故障转移时,此DNS将指向新的主服务器,但是此更改需要一些时间(小于60秒),因此在此间隔内,您可能最终指向先前的主服务器,如果可用,则现在将成为从服务器指向换一个新的贴.

Using the cluster endpoint, you are using the current writer instance. When there is a failover, this DNS will point to the new master, but this change take some time (<60s), so during that interval you may end up pointing to the previous master, that if available will be now a slave pointing to a new paster.

最好的解决方案是查询显示'innodb_read_only之类的全局变量",检查结果是否为OFF以验证连接.

The best solution is to query "show global variables like 'innodb_read_only'" checking that result is OFF to validate connection.

这篇关于使用NHibernate的.Net Application驱动程序以支持AWS Aurora的故障转移功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆