用于 HA 和 LB 的 SQL Server 复制

发布于 2024-08-19 16:11:15 字数 687 浏览 3 评论 0原文

我目前正在尝试使用 SQL Server 复制服务构建高可用性和负载平衡的 Web 应用程序 技术。自动故障转移内置于应用程序逻辑中。基本上,有两组运行相同的应用程序服务器,每组都有自己的 SQL Server 实例。它们被设置为在发生故障时使用另一个实例。数据通过事务复制在两个 SQL Server 实例之间持续复制。 (存在几秒钟的延迟,没关系。)

我以分发代理在分发服务器(= 发布服务器)上运行的方式设置了两台服务器。我的想法是,只要服务器 A(发布者)正在工作,它就会“收集”交易并在可用时将其转发到服务器 B(订阅者)。服务器 B 也是如此。默认选项(订阅者上的分发者)将在订阅者离线时“丢失”更改。我这样说对吗?更新第一个问题:交易(等待交付)存储在分发数据库中,因此无论如何它们都是“安全的”。这引出了另一个问题:如果分发代理位于订阅者上,它如何知道要交付的新交易?通过频繁的轮询?

这两个数据库具有相同的架构(身份种子和增量除外)。每个读写表都是交叉复制的。当我向表中插入一行时,为什么看不到循环?当我在文档或博客中读到有关双向复制的内容时,他们所指的是这种情况还是可更新的事务复制?

您对这种情况总体有何看法?这是我第一次进行复制,我担心风险。因此,非常欢迎任何评论。

I'm currently trying to build a high-availability and load-balanced web application with SQL Server Replication Services technologies. Automatic fail-over is built into the application logic. Basically, there are two groups of application servers running the same, each with its own SQL Server instance. They are set to use the other instance in case of failure. Data is continously replicated between the two SQL Server instances via transactional replication. (A few seconds lag exists, that's okay.)

I set up both servers in a way that Distribution agents run on the Distributor (= Publisher). My idea is, that as long as Server A (publisher) is working, it 'collects' the transactions and forwards them to Server B (subscriber) as soon as it's available. The same for Server B. The default option (distributor on the subscriber) would 'lose' changes while the subscriber is offline. Am I right with that? UPDATE to this first question: transactions (waiting to be delivered) are stored in the distribution database, so they are "safe" anyway. This leads be to another question: if the Distributor Agent is on the subscriber, how will it know about new transactions to be delivered? Via frequent polling?

The two databases have the same schema (except identity seed and increment). Each read-write table is cross-replicated. Why don't I see a loop, when I insert a row into a table? When I read about bi-directional replication in documents or blogs, is this scenario what they mean or rather updateable transactional replication?

What do you think about this scenario in general? This is my first time with replication, and I fear the risks. Therefore any comments are very welcome.

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文