SQL Server 2008 镜像使用什么机制来通知驱动程序主数据库已进行故障转移?

发布于 2024-12-11 10:22:42 字数 537 浏览 0 评论 0原文

  • 我有一个使用 SQL 2008 镜像进行镜像的数据库。

  • 我有一个 java 应用程序,在 Linux 上运行,使用 Microsoft SQL type 4 JDBC 驱动程序。

  • 我将此设置复制为 QA 环境。

  • 在我的 QA 环境中,当我手动对数据库进行故障转移时, 如果已经建立了成功的连接,则故障转移 是完全透明的。我不需要实施任何东西 为了让应用程序与新的原理(旧的 镜像)。

  • 然而,在实际环境中,一旦我连接就停止工作 已手动进行故障转移。

    实时环境和 QA 环境之间有很多不同之处,但我认为这对这个过程没有任何基础,数据库之间的通信在这两种情况下都是非常本地化的,并且没有防火墙(除了内置的防火墙) Windows Server 2008)在我的 java 应用程序和运行 SQL 2008 的 Windows 机器之间。
    有人对我如何诊断这个问题有任何想法吗?或者任何人都可以告诉我这种故障转移透明度是如何发生的,以便我可以自己解决如何诊断这个问题?

  • I've got a database that is mirrored using SQL 2008 Mirroring.

  • I have a java application, running on Linux, using the Microsoft SQL
    type 4 JDBC drivers.

  • I have this setup duplicated as a QA environment.

  • On my QA environment, when I manually fail over the database,
    providing a successful connection had already been made, the failover
    was completely transparent. I did not have to implement anything in
    order to get the application to talk to the new Principle (Old
    mirror).

  • In the live environment however, the connections stop working once I
    have manually failed over.

    There are quite a few things different between the live and QA environments, but not anything I'd consider fundamental to this process, communication between databases is all very localised in both situations and there are no firewalls (Except the ones built into Windows Server 2008) between my java app and the Windows boxes running SQL 2008.
    Does anyone have any ideas about how I can go about diagnosing this issue? Or can anyone tell me how this failover transparency occurs so I can work out how to diagnose this myself?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

梅窗月明清似水 2024-12-18 10:22:42

此行为由 SQL Server 提供程序作为客户端重定向行为的一部分进行处理。这是 SQL Server 2005 JDBC(Java 数据库连接)1.1 驱动程序的一部分,但我不确定该提供程序是否直接用于新的类型 4 驱动程序?

在您的实时环境中,您的应用程序在故障转移之前是否成功连接到主服务器,以便能够缓存故障转移伙伴并在故障转移发生时利用它?

可以肯定的是,您可以在连接字符串中显式指定故障转移伙伴,这是推荐的做法:

jdbc:sqlserver://serverA:1433;数据库名称=AdventureWorks;集成安全性=真; failoverPartner=serverB

可以在此处找到重定向行为的完整文档< /a>.

此处添加了故障转移文档表明这可能是手动考虑的。

This behaviour is handled by the SQL Server provider as part of the Client Redirect behaviour. This was part of the SQL Server 2005 JDBC (Java Database Connectivity) 1.1 Driver, I'm unsure if that provider was directly used for the new type 4 drivers though?

In your live environment, is your application successfully connecting to the primary server before it fails over, so it is able to cache the failover partner and make use of that when the failover occurs?

To be sure, you can explicitly state the failover partner in the connection string, which is the recommended practice:

jdbc:sqlserver://serverA:1433; databaseName=AdventureWorks; integratedSecurity=true; failoverPartner=serverB

The full documentation of the redirect behaviour can be found here.

The addition of the failover documentation here suggests that it could be a manual consideration.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文