In this article, we will learn the step by step configuration of SQL Server AlwaysOn High availability Group for two nodes. Once nodes are added to the cluster group, we will able to use the AlwaysOn feature in the SQL server.

在本文中,我们将学习两个节点SQL Server AlwaysOn高可用性组的分步配置。 将节点添加到群集组后,我们将能够使用SQL Server中的AlwaysOn功能。

In the following steps, we will create a Service account to connect SQL server instances. The Service account will be used to connect the SQL instance from both the node servers.

在以下步骤中,我们将创建一个服务帐户来连接SQL Server实例。 服务帐户将用于从两个节点服务器连接SQL实例。

创建服务帐户 (Create a Service Account)

We will log in to the Domain controller and perform the following steps.

我们将登录到域控制器并执行以下步骤。

Open Server Manager, Tools and Click Active Directory Users and Computers.

打开服务器管理器工具,然后单击“ Active Directory用户和计算机”

In Active Directory Users and Computers window, Right-Click Users > New > User as shown in the following Fig.

在“ Active Directory用户和计算机”窗口中, 右键单击“用户”>“新建”>“用户” ,如下图所示。

In this step, we will create a Service account username, Specify the service account login name and Click Next

在此步骤中,我们将创建一个服务帐户用户名,指定服务帐户登录名,然后单击“下一步”。

Specify a Password and tick the options for User cannot change password and Password never expires. We need to select Password never expires option because, if the password expired, the service account login would fail, and it will cause a problem to the high availability configuration.

指定密码,然后勾选“ 用户无法更改密码密码永不过期”选项 。 我们需要选择“ 密码永不过期”选项,因为如果密码过期,则服务帐户登录将失败,这将对高可用性配置造成问题。

Click Finish to complete the service account creation process.

单击完成以完成服务帐户创建过程。

配置管理员权限,Windows用户和服务帐户的登录名 (Configure Administrator permission, windows user and login for the service account)

Once the Service account created on the Domain controller, we need to add service account as a member of the administrator account on both nodes.

在域控制器上创建服务帐户后,我们需要在两个节点上将服务帐户添加为管理员帐户的成员。

Connect to both node servers SQL1 and SQL2 and perform below steps

连接到两个节点服务器SQL1和SQL2并执行以下步骤

  • Add Service account as an Administrator 将服务帐户添加为管理员
  • Create a Windows user for the Service account 为服务帐户创建Windows用户
  • Create a Windows authentication login for a service account login in the SQL database instance 在SQL数据库实例中为服务帐户登录创建Windows身份验证登录

Open Server manager and Select Tools and Computer Management

打开服务器管理器,然后选择“ 工具计算机管理”

In the Computer management window, Select Groups and Right-Click Administrators and Go to Properties

“计算机管理”窗口中 ,选择“ 组”,然后右键单击“ 管理员”,然后转到“ 属性”。

Add User, Enter the Service account login name and Check names and Click OK

添加用户,输入服务帐户登录名和检查名称,然后单击确定

Note – Once clicked on the Check Names, it may ask to enter username and password pop-up window. In the pop-up window, we need to register a domain controller username and password and make sure the location should select as a directory.

注–单击“检查名称”后,可能会要求输入用户名和密码弹出窗口。 在弹出窗口中,我们需要注册域控制器的用户名和密码,并确保将位置选择为目录。

In the following Fig. We will create the Service account as a windows user in Control Panel > User Account > Click on Manage User Accounts.

在下图中。我们将在控制面板>用户帐户>单击管理用户帐户中以Windows用户身份创建服务帐户

Enter a Service account name and domain name and Click Next, Select Administrator and Finish

输入服务帐户名域名,然后单击“ 下一步” ,选择“ 管理员”并单击完成”。

Next, we will create a windows authentication login for the service account as shown in the following fig.

接下来,我们将为服务帐户创建Windows身份验证登录名,如下图所示。

Take remote desktop connection of SQL1 with the service account windows user, connect to the SQL Server database engine instance SQL1 with default windows authentication login as shown in the following fig.

使用服务帐户Windows用户进行SQL1的远程桌面连接,并使用默认的Windows身份验证登录名连接到SQL Server数据库引擎实例SQL1,如下图所示。

启用AlwaysOn功能 (Enable AlwaysOn Feature)

Once SQL Server instance is connected, we need to decide database which will take part in SQL Server AlwaysOn High Availability.

连接SQL Server实例后,我们需要确定将要加入SQL Server AlwaysOn高可用性的数据库。

In this demonstration, we will create a new database STUDENT, and then we will create a table and add a few records into it as shown in the following fig.

在此演示中,我们将创建一个新的数据库STUDENT ,然后将创建一个表并向其中添加一些记录,如下图所示。

Next, Expand SQL Server AlwaysOn High Availability option, we will get an error while expanding the AlwaysOn option

接下来,展开“ SQL Server AlwaysOn高可用性”选项,在扩展“ AlwaysOn”选项时会出现错误

The AlwaysOn feature must be enabled for the server instance ‘SQL1’ before you can create an availability group on this instance. To enable AlwaysOn, open the SQL Server Configuration Manager, select SQL Server Services, right-click the SQL Server instance name, select Properties, and use the AlwaysOn High Availability tab of the SQL Server Properties dialog. (ObjectExplorer)

必须先为服务器实例“ SQL1”启用AlwaysOn功能,然后才能在该实例上创建可用性组。 若要启用AlwaysOn,请打开SQL Server配置管理器,选择SQL Server服务,右键单击SQL Server实例名称,选择“属性”,然后使用“ SQL Server属性”对话框的AlwaysOn高可用性选项卡。 (对象浏览器)

To enable AlwaysOn feature, Open SQL Server Configuration Manager, Right-click SQL Server instance and go to properties, Select AlwaysOn High Availability tab section and tick checkbox for Enable AlwaysOn AvailabilityGroups

要启用AlwaysOn功能,请打开SQL Server配置管理器右键单击SQL Server实例转到属性 ,选择AlwaysOn高可用性选项卡部分,然后选中启用AlwaysOn AvailabilityGroups复选框。

Note: – We also need to make sure nodes where we will enable AlwaysOn feature is part of Windows Failover Cluster.

注意:– 我们还需要确保要启用AlwaysOn功能的节点是Windows故障转移群集的一部分。

Once we enabled, Apply and Click OK. Restart the SQL Server services.

启用后,应用并单击确定 。 重新启动SQL Server服务。

As shown in the following fig. we will able to use SQL Server AlwaysOn High Availability feature. Right-click Availability Groups and Click New Availability Group.

如下图所示。 我们将能够使用SQL Server AlwaysOn高可用性功能。 右键单击可用性组,然后单击新建可用性组

配置可用性组 (Configuring Availability Group)

An AlwaysOn Availability Group contains a set of user databases; we need to select user databases which will be part of the Availability group. These databases called as an Availability database.

AlwaysOn可用性组包含一组用户数据库。 我们需要选择将成为“可用性”组一部分的用户数据库。 这些数据库称为可用性数据库。

Specify Availability Group name and click Next

指定可用性组名称 ,然后单击下一步。

As shown in fig. we will use database STUDENT. To proceed further, we need to perform one essential pre-requisite step, a Full backup of the database. So, take a Full backup of STUDENT and click Next

如图所示。 我们将使用数据库STUDENT 。 要进一步进行操作,我们需要执行一个基本的先决条件步骤,即数据库的完整备份。 因此,请对学生进行完整备份,然后单击“ 下一步”。

Next, Specify Replica step has four sections. Replica, Endpoint, Backup Preferences, and Listener

接下来,“ 指定副本”步骤包含四个部分。 副本,端点,备份首选项和侦听器

Replica– Replica is a server. There are one primary replica and multiple replicas. In SQL server 2012, It supports up to 4 secondary replicas, while in SQL Server 2014, it supports up to 8 replicas.

Replica-副本 一台服务器。 有一个主副本和多个副本。 在SQL Server 2012中,它最多支持4个辅助副本,而在SQL Server 2014中,它最多支持8个副本。

The primary replica is primary source server or production server. A secondary replica is a server which maintain a backup copy of the primary server availability database. On the Primary replica, it allows to perform Read and write operations while on the secondary replica only read operations.

主副本是主源服务器或生产服务器。 辅助副本是一台服务器,用于维护主服务器可用性数据库的备份副本。 在主副本上,它允许执行读取和写入操作,而在辅助副本上,只能执行读取操作。

In this case, SQL1 is our primary replica and SQL2 is a secondary replica. So, we will add SQL2 as a secondary replica as shown in the following fig.

在这种情况下,SQL1是我们的主副本,SQL2是辅助副本。 因此,我们将添加SQL2作为辅助副本,如下图所示。

Initial Role – It specifies the role of replica whether Primary or secondary.

初始角色 –指定副本的角色,无论是Primary还是secondary

Automatic Failover – It failovers functional role from primary replica to secondary replica by an automated method with no data loss.

自动故障转移 –通过自动方法将功能角色从主副本故障转移到辅助副本,而不会丢失数据。

Synchronous Commit – In the Synchronous-commit mode, failover can happen by either Automatic or manual way with no data loss. So, in this case, we will use synchronous commit with automatic failover.

同步提交–在同步提交模式下,可以通过自动或手动方式进行故障转移,而不会丢失数据。 因此,在这种情况下,我们将使用具有自动故障转移功能的同步提交。

Once clicked Add Replica, connect to the server, Select SQL2 and Connect

单击添加副本后 ,连接到服务器,选择SQL2并连接

Once we add secondary server SQL2 as a secondary replica, the primary role of SQL2 is secondary.

一旦将辅助服务器SQL2添加为辅助副本,SQL2的主要角色就是辅助角色。

In the Endpoint section, it will show configured endpoint URL, port, endpoint name, and the service account name for SQL1 and SQL2 nodes.

在“端点”部分,它将显示为SQL1和SQL2节点配置的端点URL,端口,端点名称和服务帐户名称。

Backup Preferences – Backup preferences indicate the backup location of the availability group. It provides four backup options.

备份首选项–备份首选项指明了备份位置 可用性组。 它提供了四个备份选项。

  • Prefer Secondary – Automatic backup will occur on a secondary replica 首选二级 -自动备份将在二级副本上进行
  • Secondary only – Automatic backup must occur on a secondary replica 仅辅助数据库 –必须在辅助副本上进行自动备份
  • Primary – Automatic backup must occur on a primary replica -自动备份必须在主副本上进行
  • Any Replica – Backup will occur on any replica 任何副本 –备份将在任何副本上进行

On the secondary replica, we can only take a log backup, and Copy-only backup, Differential, and Full back up are not allowed on a secondary replica. While on the primary replica, we can perform Full, log, and Differential backups.

在辅助副本上,我们只能进行日志备份,并且在辅助副本上不允许仅复制备份,差异备份和完整备份。 在主副本上时,我们可以执行完整,日志和差异备份。

Listener– Listener is a server through which nodes get to communicate with each other. The Listener has all information about availability group. We need to select Create an Availability group listener option and specify Name, Port and static IP as shown in the following fig.

侦听器 –侦听器是一台服务器,节点可通过该服务器相互通信。 侦听器具有有关可用性组的所有信息。 我们需要选择创建可用性组侦听器选项,并指定名称,端口和静态IP,如下图所示。

In Data Synchronization step, Select Full where it performs Full and Log backup and puts it into shared location path.

在“ 数据同步”步骤中 ,选择“ 完整” ,在该位置执行完整和日志备份,并将其放入共享位置路径。

创建共享位置 (Create a Shared location)

Connect to node SQL1 and choose desired drive location and folder, Right-click folder and Go to Properties, Select Security and click Share. It will show a pop-up window to add a user to whom, share permission need to grant.

连接到节点SQL1并选择所需的驱动器位置和文件夹, 右键单击文件夹转到属性选择安全性 ,然后单击共享 。 它将显示一个弹出窗口,向其添加需要授予共享权限的用户。

Provide the service account name and Click Add; it will show pop-up window to check names, once service account name found in the domain name, click Share.

提供服务帐户名称,然后单击添加 ; 它会显示一个弹出窗口以检查名称,一旦在域名中找到服务帐户名,请单击“ 共享”

In the Validation step, SQL Server performs validations against any required actions, and It will provide warning or error messages for missing required steps.

“验证”步骤中 ,SQL Server对所有必需的操作执行验证,并且它将针对缺少的必需步骤提供警告或错误消息。

It performed all validation steps successfully, and wizard operation completed as shown in the following fig.

它成功执行了所有验证步骤,并且向导操作完成,如下图所示。

After successful completion, we will verify the database at secondary replica SQL2. As we can observe, Database STUDENT is in Synchronizing state, and it is in sync with the primary replica, and we can read data successfully.

成功完成后,我们将在辅助副本SQL2上验证数据库。 如我们所见,Database STUDENT处于同步状态,并且与主副本同步,我们可以成功读取数据。

目录 (Table of contents)

Domain Controller and Domain Client Node setup for AlwaysON High Availability
iSCSI, iSCSI Initiator, Quorum Configuration and SQL Server Cluster Installation
Configuring a SQL Server AlwaysOn High Availability Group
用于AlwaysON高可用性的域控制器和域客户端节点设置
iSCSI,iSCSI发起程序,仲裁配置和SQL Server群集安装
配置SQL Server AlwaysOn高可用性组

翻译自: https://www.sqlshack.com/configuring-a-sql-server-alwayson-high-availability-group/

配置SQL Server AlwaysOn高可用性组相关推荐

  1. 基于Windows Server 2008 R2的WSFC实现SQL Server 2012高可用性组(AlwaysOn Group)

    2012年5月 微软新一代数据库产品SQL Server 2012已经面世一段时间了,不管从功能还是性能上讲,较之其早期产品都有了很大提升.特别是其引入高可用性组(AlwaysOn Group, AG ...

  2. SQL Server 2012高可用性组

    SQL Server 2012高可用性组在实现过程中较之早起的SQL Server故障转移群集来讲,不依赖特别提供共享存储磁盘阵列,每个节点独立存储一份数据库的副本 两年前的<SQL Serve ...

  3. mysql alwayson_配置SQL Server 2012的AlwaysOn高性能组件

    AlwaysOn取数据库镜像和故障转移集群之长.AlwaysOn不再像故障转移集群那样需要共享磁盘,从而主副本和辅助副本可以更容易的部署 AlwaysOn取数据库镜像和故障转移集群之长.AlwaysO ...

  4. 配置SQL Server 2016无域AlwaysOn

    Windows Server 2016 以及 SQL Server 2016出来已有一段时间了,因为Windows Server 2016可以配置无域的Windows群集,因此也能够以此来配置无域的S ...

  5. SQL Server AlwaysON从入门到进阶(1)——何为AlwaysON?

    本文属于SQL Server AlwaysON从入门到进阶系列文章 本文原文出自Stairway to AlwaysOn系列文章.根据工作需要在学习过程中顺带翻译以供参考.系列文章包含: SQL Se ...

  6. Docker 容器部署 SQL Server AlwaysOn AG

    SQL Server 2016 开始支持 Linux.随着2017 和2019 版本的推出,它开始支持Linux和Container平台上的HA/DR.Kubernetes和大数据集群解决方案. 今天 ...

  7. 从0开始搭建SQL Server AlwaysOn 第三篇(配置AlwaysOn)

    从0开始搭建SQL Server AlwaysOn 第三篇(配置AlwaysOn) 第一篇 http://www.cnblogs.com/lyhabc/p/4678330.html 第二篇 http: ...

  8. (转) 从0开始搭建SQL Server AlwaysOn 第三篇(配置AlwaysOn)

    原文地址: http://www.cnblogs.com/lyhabc/p/4682986.html 这一篇是从0开始搭建SQL Server AlwaysOn 的第三篇,这一篇才真正开始搭建Alwa ...

  9. 从0开始搭建SQL Server AlwaysOn 第四篇(配置异地机房节点)

    从0开始搭建SQL Server AlwaysOn 第四篇(配置异地机房节点) 第一篇 http://www.cnblogs.com/lyhabc/p/4678330.html 第二篇 http:// ...

最新文章

  1. Java实现有序数组和无序数组_【算法】字典的诞生:有序数组 PK 无序链表
  2. 数字发行:电子书、电影、游戏、音乐
  3. Visual C++ 时尚编程百例005(菜单)
  4. php中的$_server,细说PHP中的$_SERVER
  5. yaf(5) smarty
  6. 67 个JavaScript和CSS实用工具、库与资源
  7. 算法设计与分析———动态规划———最大子段和
  8. ggplot2 | 使用小提琴图+箱形图+抖动图展示数据分布情况
  9. 1054. 求平均值
  10. Ubuntu18.04关闭ibus-daemon自启动
  11. JAVA多线程面试题整理及答案
  12. 文件描述符 fd 究竟是什么?
  13. 关于微信小程序中时间预约的简单实现
  14. 百度小程序SEO指南
  15. 关于风险回归的Cox 模型构建,森林图(1)
  16. 原文 葛底斯堡宣言_如何有感情地背下葛底斯堡演说的全文?
  17. LeetCode每日一题——904. 水果成篮
  18. 我的数字IC学习路线
  19. 请求的内容似乎是脚本,因而将无法由静态文件处理程序来处理。
  20. 不同域名网站携带信息跳转并保存到localStorage中

热门文章

  1. python中颜色空间直方图_OpenCV—python 颜色空间(RGB,HSV,Lab)与 颜色直方图
  2. java获得map内存_[java]测试static的map的内存
  3. springboot actuator_Spring Boot之程序性能监控
  4. java.lang.ClassNotFoundException: com.sun.xml.ws.spi.ProviderImpl解决办法
  5. mysql的建表语句
  6. 006 - node.js
  7. 数据结构与算法(updating....)
  8. 百度地图API的使用教程以及案例
  9. 网购组装电脑整机为什么便宜?
  10. erp系统是什么东西