数据库复制还是镜像?
SQL Server 2005 中的复制和镜像有什么区别?
What is the difference between Replication and Mirroring in SQL server 2005?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
SQL Server 2005 中的复制和镜像有什么区别?
What is the difference between Replication and Mirroring in SQL server 2005?
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(3)
简而言之,镜像允许您让第二台服务器成为主服务器的“热”备用副本,随时准备在主服务器发生故障时接管。 因此镜像提供了故障转移和可靠性。
另一方面,复制允许两个或多个服务器保持“同步” - 这意味着辅助服务器可以回答查询并(取决于设置)实际更改数据(它将在同步中合并)。 您还可以将其用于本地缓存、负载平衡等。
In short, mirroring allows you to have a second server be a "hot" stand-by copy of the main server, ready to take over any moment the main server fails. So mirroring offers fail-over and reliability.
Replication, on the other hand, allows two or more servers to stay "in sync" - that means the secondary servers can answer queries and (depending on setup) actually change data (it will be merged in the sync). You can also use it for local caching, load balancing, etc.
镜像是一种在位级别创建数据库副本的功能。 基本上,您在两个地方拥有相同的数据库。 您不能选择性地忽略数据库的某些部分。 您只能拥有一个镜像,并且该“镜像”始终处于离线状态(无法修改)。 镜像的工作原理是将正在创建的数据库日志传送到镜像并在镜像上应用(重做)日志。 镜像是一种实现高可用性和灾难恢复性的技术。
复制是一种允许在多个站点之间复制数据库“片段”的功能。 “切片”可以是一组数据库对象(即表),但它也可以包含表的一部分,例如仅某些行(水平切片)或仅要复制的某些列。 您可以拥有多个副本,并且“副本”可供查询,甚至可以更新。 复制的工作原理是跟踪/检测更改(通过触发器或扫描日志)并将更改作为 T-SQL 语句传送给订阅者(副本)。 复制是一种使数据在异地可用并将数据整合到中央站点的技术。 虽然它有时用于高可用性或灾难恢复性,但它是镜像和日志传送更好地解决问题的人为用途。
复制有多种类型和风格(合并、事务、点对点等),它们在实现更改跟踪或更新传播的方式上有所不同,如果您想了解更多详细信息,您应该阅读 有关该主题的 MSDN 规范。
Mirroring is a feature that creates a copy of your database at bit level. Basically you have the same, identical, database in two places. You cannot optionally leave out parts of the database. You can have only one mirror, and the 'mirror' is always offline (it cannot be modified). Mirroring works by shipping the database log as is being created to the mirror and apply (redo-ing) the log on the mirror. Mirroring is a technology for high availability and disaster recoverability.
Replication is a feature that allow 'slices' of a database to be replicated between several sites. The 'slice' can be a set of database objects (ie. tables) but it can also contain parts of a table, like only certain rows (horizontal slicing) or only certain columns to be replicated. You can have multiple replicas and the 'replicas' are available to query and even can be updated. Replication works by tracking/detecting changes (either by triggers or by scanning the log) and shipping the changes, as T-SQL statements, to the subscribers (replicas). Replication is a technology for making data available at off sites and to consolidate data to central sites. Although it is sometimes used for high availability or for disaster recoverability, it is an artificial use for a problem that mirroring and log shipping address better.
There are several types and flavours of replication (merge, transactional, peer-to-peer etc.) and they differ in how they implement change tracking or update propagation, if you want to know more details you should read the MSDN spec on the subject.
数据库镜像用于增加数据库的正常运行时间和可靠性。
复制主要用于将主数据库(发布者)的一部分分发到一个或多个订阅者数据库。 这样做通常是为了使数据在远程服务器上可用(通常为只读),以便远程客户端可以在本地(对他们)访问数据,而不是通过较慢的 WAN 连接直接从发布者访问数据。 尽管如此,正如之前的帖子所指出的,还有更复杂的情况允许订阅者进行更新。 它还可以减少发布者的 I/O 负载。
Database mirroring is used to increase database uptime and reliability.
Replication is used primarily to distribute portions of your primary database -- the publisher -- to one or more subscriber databases. This is often done to make data available (typically for read only) on remote servers so that remote clients can access the data locally (to them) rather than directly from the publisher across a slower WAN connection. Although, as the previous posts indicate, there are more complex scenarios where updates are permitted on the subscribers. It also can have the benefit of reducing the I/O load on the publisher.