[AlwaysOn] AlwaysOn可用性组的故障转移和故障转移模式[中英文对照] 5

4 、计划的手动故障转移(无数据丢失)

4 、Planned Manual Failover (Without Data Loss)

在数据库管理员针对承载目标辅助副本的服务器实例发出手动故障转移命令后,手动故障转移将导致已同步的辅助副本转换为主角色。为了支持手动故障转移,辅助副本和当前主副本必须同时配置为同步提交模式(如果有)。可用性副本上的每个辅助数据库都必须加入到可用性组中,并与其对应的主数据库同步(也即,必须同步辅助副本)。这可确保对先前主数据库提交的每个事务也对新的主数据库提交。因此,新的主数据库与旧的主数据库完全相同。

A manual failover causes a synchronized secondary replica to transition   to the primary role after a database administrator issues a manual-failover   command on the server instance that hosts the target secondary replica. To   support manual failover, the secondary replica and the current primary   replica must both be configured for synchronous-commit mode, if any. Every   secondary database on the availability replica must be joined to the   availability group and synchronized with its corresponding primary database   (that is, the secondary replica must be synchronized). This guarantees that   every transaction that was committed on a former primary database has also   been committed on the new primary database. Therefore, the new primary   databases are identical to the old primary databases.

下图说明计划的故障转移的各个阶段:

The following figure illustrates the stages of a planned failover:

1. 在故障转移之前,主副本位于 Node01 的服务器实例上。

1. Before the failover, the primary replica is hosted by the server   instance on Node01 .

2. 数据库管理员启动计划的故障转移。故障转移目标为位于 Node02 的服务器实例上的可用性副本。

2.A database administrator initiates a planned failover. The failover   target is the availability replica hosted by the server instance on Node02 .

3. 故障转移目标(位于 Node02 上)将成为新的主副本。因为这是计划的故障转移,以前的主副本在故障转移期间切换为辅助角色,并且使其数据库立即联机作为辅助数据库。

3. The failover target (on Node02 ) becomes the new primary replica. Because this is a planned failover,   the former primary replica switches to the secondary role during the failover   and brings its databases online as secondary databases immediately.

4.1 、手动故障转移所需条件

4.1 、Conditions Required for a Manual Failover

为了支持手动故障转移,当前主副本必须设置为同步提交模式,而辅助副本必须:

To support a manual failover, the current primary replica must be set to   synchronous-commit mode and a secondary replica must be:

·        配置为同步提交模式。

·        Configured for synchronous-commit mode.

·        当前已与主副本同步。

·        Currently synchronized with the primary replica.

若要手动对可用性组执行故障转移,您必须连接到将成为新的主副本的辅助副本。

To manually fail over an availability group, you must be connected to   the secondary replica that is to become the new primary replica.

4.2 、计划的手动故障转移的工作方式

4.2 、How a Planned Manual Failover Works

计划的手动故障转移(必须在目标辅助副本上启动)将启动以下操作序列:

A planned manual failover, which must be initiated on the target   secondary replica, initiates the following sequence of actions:

1. 为了确保在原始主数据库上不发生任何新的用户事务,WSFC群集向主副本发送要求脱机的请求。

1.To ensure that no new user transactions occur on the original primary   databases, the WSFC cluster sends a request to the primary replica to go   offline.

2. 如果任何辅助数据库的恢复队列中有任何日志处于等待状态,则辅助副本将完成对辅助数据库进行前滚的操作。所需时间取决于系统速度、最新工作负荷以及恢复队列中的日志量。若要了解恢复队列的当前大小,请使用 Recovery Queue性能计数器。有关详细信息,请参阅 SQL Server ,数据库副本

2. If any log is waiting in the recovery queue of any secondary   database, the secondary replica finishes rolling forward that secondary   database. The amount of time required depends on the speed of the system, the   recent workload, and the amount of log in the recovery queue. To learn the   current size of the recovery queue, use the Recovery Queue performance   counter. For more information, see SQL Server,   Database Replica.

备注

Remarks

可通过限制恢复队列的大小调整故障转移时间。不过,这会导致主副本的速度下降,以允许辅助副本与其同步。

The failover time can be regulated by limiting the size of the recovery   queue. However, this can cause the primary replica to slow down to allow the   secondary replica to keep up.

3. 辅助副本成为新的主副本,先前的主副本成为新的辅助副本。

3.The secondary replica becomes the new primary replica, and the former   primary replica becomes the new secondary replica.

4. 新的主要副本会回滚任何未提交的事务,并使其数据库作为主数据库上线。所有辅助数据库都简要标记为“不同步”,直到它们连接并重新同步到新的主数据库。此过程不会回滚任何已提交的事务。

4.The new primary replica rolls back any uncommitted transactions and   brings its databases online as the primary databases.All secondary databases   are briefly marked as NOT SYNCHRONIZED until they connect and resynchronize   to the new primary databases. This process does not roll back any committed   transactions.

5. 当以前的主副本重新联机后,它将承担辅助角色,而以前的主数据库将成为辅助数据库。新的辅助副本快速将新的辅助数据库与对应的主数据库重新同步。

5.When the former primary replica comes back online, it takes on the   secondary role, and the former primary database becomes the secondary   database. The new secondary replica quickly resynchronizes the new secondary   databases with the corresponding primary databases.

备注

Remarks

只要新的辅助副本重新同步了数据库,就可以再次执行故障转移,但按反向执行。

As soon as the new secondary replica has resynchronized the databases,   failover is again possible, but in the reverse direction.

执行故障转移后,客户端必须重新连接到当前的主数据库。有关详细信息,请参阅 可用性组侦听程序、客户端连接和应用程序故障转移(SQL Server)概念。

After failover, clients must reconnect to the current primary database.   For more information, see Availability   Group Listeners, Client Connectivity, and Application Failover (SQL Server).

4.3 、升级期间维护可用性

4.3 、Maintaining Availability During Upgrades

当您升级硬件或软件时,可用性组的数据库管理员可以使用手动故障转移来维护数据库可用性。若要将可用性组用于软件升级,承载目标辅助副本的服务器实例和/或计算机节点必须已经收到升级。有关详细信息,请参阅 升级AlwaysOn 可用性组副本实例

The database administrator for your availability groups can use manual   failovers to maintain database availability when you upgrade hardware or   software. To use an availability group for software upgrades, the server   instance and/or computer node that hosts the target secondary replica must   have already received the upgrades. For more information, see Upgrading Always   On Availability Group Replica Instances.


来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/81227/viewspace-2655026/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/81227/viewspace-2655026/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值