Home Database Mysql Tutorial 简单实现SQL Server 2012高可用性组

简单实现SQL Server 2012高可用性组

Jun 07, 2016 pm 03:08 PM
server sql accomplish Simple

SQL Server 2012出来了,我最感兴趣的是其AlwaysOn功能,功能很强大,引用网上的话来说就是:. SQL Server 2012高可用性组在实现过程中较之早期的SQL Server故障转移群集来讲,不依赖特别提供共享存储磁盘阵列,每个节点独立存储一份数据库的副本。其较之早

SQL Server 2012出来了,我最感兴趣的是其AlwaysOn功能,功能很强大,引用网上的话来说就是:.

SQL Server 2012高可用性组在实现过程中较之早期的SQL Server故障转移群集来讲,不依赖特别提供共享存储磁盘阵列,每个节点独立存储一份数据库的副本。其较之早期的镜像数据库来讲,提供多节点高可用,并且针对数据库辅助节点副本可读;此外,在当前可读节点出现故障时,能通过AG自身的机制保证数据库正常访问,而不需要像之前的镜像数据库一样,需要通过访问端来进行切换。

AlwaysOn相比之前的数据库镜像强大,因为副本可设置为可读,这样可以减少主数据库的压力;当主节点故障时,副本可自动接管主节点的服务(10秒内完成)。

我用了三台服务器来实现AlwaysOn高可用性组,暂称之为DC、DB1、DB2,服务器的操作系统均为Windows 2008 R2 SP1 企业版,都加入域中(在此不做详述),DC为域控制器;DB1为数据库主节点;DB2为数据库副节点,在域控制器上创建SQLAdmin用户,此用户用来启动SQL Server服务和对共享目录的访问。

一、要实现故障转移,首先必须在DB1和DB2上安装“故障转移集群”功能:

   1、在DC上创建一个共享目录,设置SQLAdmin用户对此目录具有读写权限,此目录涉及集群的仲裁,故不应该创建在故障转移集群中。

   2、安装WSFC群集组件:

   1)打开服务器管理器,选择“功能”,在右边窗口中点击“添加功能”:

  

   2)在“添加功能向导”中,勾选“故障转移集群”,点击“下一步”:

  

   3)在“确认安装选择”页面中,点击“安装”,进行安装操作:

  

   4)完成并关闭“故障转移群集”的安装:

  

  3、配置WSFC,为所有节点均安装完“故障转移群集”服务后,在任意节点服务器的“服务器管理器”中展开“故障转移群集管理器”对WSFC进行配置。

   1)通过“故障转移群集管理器”窗口点击“创建一个群集”打开“创建群集向导”:

  

  2)在“开始之前”页中,点击“下一步”:

 

  3)添加所有服务器节点,即将环境中的2台成员服务器添加为群集节点服务器。点击“下一步”:

 

  4)在“验证警告”页面中,如果需要对基本环境(包括硬件)进行WSFC需求验证,可以选择“是”。在本示例中由于不必需进行验证,所以选择“否”。点击“下一步”:

 

  5)定义“用于管理群集的访问点”,为群集进行名,并指定群集IP地址。点击“下一步”:

 

  6)确认之前配置信息,若无误,点击“下一步”,开始群集创建:

 

  7)完成群集创建,点击“完成”关闭向导:

 

  8)在“故障转移群集管理器”会显示成功创建的群集,展开其“节点”,显示现有节点情况:

 

  9)右击群集节点,在上下文菜单中点击“更多操作”,在扩展菜单中选择“配置群集仲裁设置”为该群集配置仲裁:

 

  10)在“开始之前”页面中点击“下一步”:

 

  11)根据此前的设计,由于只有两个节点,并且没有共享磁盘存储存在,所以可以选择“多数节点和文件共享”(关于仲裁方式的选择,可参考http://technet.microsoft.com/zh-cn/library/cc731739.aspx),点击“下一步”,然后根据提示选择第一步创建的共享目录。

  12)在“确认”页面中,点击“下一步”:

 

  13)完成WSFC的仲裁配置:

 

  至此,为SQL Server 2012 AG准备的WSFC环境已经完成。

  二、为DB1、DB2安装SQL Server 2012:

  1、安装SQL Server 2012,在节点服务器上,插入SQL Server 2012安装介质。运行“SQL Server安装中心”,选择“安装”,点击“全新SQL Server独立安装或向现有安装添加功能”,安装步骤跳过,详细请看本文后面链接中的文章。

  注:这里不要选择“新的SQL Server故障转移群集安装”,如果是故障转移群集安装的话最终将实现的是早期的SQL数据库群集,并且需要共享数据存储磁盘整列,导致所有SQL节点共享同一个数据存储副本。

  2、为高可用性组配置SQL Server 2012数据库引擎服务。

  1)在“开始”菜单中点击“所有程序”-“Microsoft SQL Server 2012”-“配置工具”,打开“SQL Server配置管理器”:

 

  2)在控制台中点击“SQL Server服务”节点,在右边窗口中右击“SQL Server (MSSQLSERVER)”,在上下文菜单中选择“属性”:

 

  3)在弹出窗口中选择“AlwaysOn 高可用性”选项卡中勾选“启用AlwaysOn 可用性组”。点击“确认”。

 

  4)在弹出警告对话框中提示该修改需要重启SQL Server数据库引擎服务才能生效,点击“确定”:

 

  5)再次右击“SQL Server (MSSQLSERVER)”,在上下文菜单中选择“重新启动”,对数据库引擎执行重启操作:

 

  6)为了避免在实现AlwaysOn Group时带来复杂的权限设置,建议将相关的SQL服务(如:SQL Server数据库引擎服务)启动登录身份由默认的“内置账户”改为指定的域账户(SQLAdmin用户):

   

  7)建议为该域账户授予各节点SQL Server登录权限,并将各节点服务器账户指派为SQL Server登录账户。

 

 

 

 

 

 

 

  三、创建配置高可用性组

  1、准备工作:将需要用作同步的数据库的恢复模式设置为“完整模式”:

 

  并且该数据库已经进行了一次备份操作:

 

  需要一个共享路径提供给备份包存储,并允许所有节点服务器(SQL Server数据库引擎服务登录账户)能够通过UNC路劲进行可读写访问:

 

  2、利用向导新建高可用性组

 

 

  1)在“开始”菜单中点击“所有程序”-“Microsoft SQL Server 2012”-“配置工具”,打开“SQL Server Management Studio”:

 

  2)展开“AlwaysOn高可用性”节点,右击“可用性组”,在上下文菜单中,选择“新建可用性组向导”:

 

  3)在“简介”页面点击“下一步”:

   

  4)为将要创建的高可用性组指定名称:

 

 

 

 

  5)选择满足加入高可用性组条件的数据库,点击“下一步”:

 

  6)为高可用性组添加其它SQL Server服务器节点为副本。点击“添加副本”按钮,一次添加所需SQL Server服务器,并且指定初始角色为“主”或“辅助”。最多可选2个副本实现自动故障转移,这两个副本将同时使用同步提交可用性模式。最多可支持3个副本进行同步提交可用性模式,若使用异步提交必须强制手动故障转移。对于可读辅助副本设置来讲,可选择其为是否可读或仅读意向,需要注意只有主数据库副本才可写:

 

  7)为高可用性组创建侦听器,指定其DNS名称的Host Name和端口,建议IP地址使用静态IP,并且添加新的群集IP作为高可用性组使用,如此可以指定SQL Server的默认端口1443,以便简化客户端访问的配置。:

 

  8)初始化数据同步首选项,建议选择“完整”,并指定之前创建的UNC共享路径。一直点“下一步” 。

  9)直到最终完成,所有摘要均成功完成,显示绿色对勾。如果出现黄色警告,则需进行进一步判断是否成功。若出现红色错误,表示创建AG不成功。

  10)返回SSMS窗口,在“可用性组”节点下显示“AG01”的面板,可以观察该高可用性组的状态:

 

  到此,SQL Server 2012基于AlwaysOn的高可用性群组就创建完成了,下一篇文章将对本文创建的群组进行可用性测试。

  本文主要参考和引用了TechNet 上的内容,我在此表示感谢。

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

The easiest way to query the hard drive serial number The easiest way to query the hard drive serial number Feb 26, 2024 pm 02:24 PM

The hard disk serial number is an important identifier of the hard disk and is usually used to uniquely identify the hard disk and identify the hardware. In some cases, we may need to query the hard drive serial number, such as when installing an operating system, finding the correct device driver, or performing hard drive repairs. This article will introduce some simple methods to help you check the hard drive serial number. Method 1: Use Windows Command Prompt to open the command prompt. In Windows system, press Win+R keys, enter "cmd" and press Enter key to open the command

What is the difference between HQL and SQL in Hibernate framework? What is the difference between HQL and SQL in Hibernate framework? Apr 17, 2024 pm 02:57 PM

HQL and SQL are compared in the Hibernate framework: HQL (1. Object-oriented syntax, 2. Database-independent queries, 3. Type safety), while SQL directly operates the database (1. Database-independent standards, 2. Complex executable queries and data manipulation).

Usage of division operation in Oracle SQL Usage of division operation in Oracle SQL Mar 10, 2024 pm 03:06 PM

"Usage of Division Operation in OracleSQL" In OracleSQL, division operation is one of the common mathematical operations. During data query and processing, division operations can help us calculate the ratio between fields or derive the logical relationship between specific values. This article will introduce the usage of division operation in OracleSQL and provide specific code examples. 1. Two ways of division operations in OracleSQL In OracleSQL, division operations can be performed in two different ways.

Comparison and differences of SQL syntax between Oracle and DB2 Comparison and differences of SQL syntax between Oracle and DB2 Mar 11, 2024 pm 12:09 PM

Oracle and DB2 are two commonly used relational database management systems, each of which has its own unique SQL syntax and characteristics. This article will compare and differ between the SQL syntax of Oracle and DB2, and provide specific code examples. Database connection In Oracle, use the following statement to connect to the database: CONNECTusername/password@database. In DB2, the statement to connect to the database is as follows: CONNECTTOdataba

How to implement dual WeChat login on Huawei mobile phones? How to implement dual WeChat login on Huawei mobile phones? Mar 24, 2024 am 11:27 AM

How to implement dual WeChat login on Huawei mobile phones? With the rise of social media, WeChat has become one of the indispensable communication tools in people's daily lives. However, many people may encounter a problem: logging into multiple WeChat accounts at the same time on the same mobile phone. For Huawei mobile phone users, it is not difficult to achieve dual WeChat login. This article will introduce how to achieve dual WeChat login on Huawei mobile phones. First of all, the EMUI system that comes with Huawei mobile phones provides a very convenient function - dual application opening. Through the application dual opening function, users can simultaneously

Detailed explanation of the Set tag function in MyBatis dynamic SQL tags Detailed explanation of the Set tag function in MyBatis dynamic SQL tags Feb 26, 2024 pm 07:48 PM

Interpretation of MyBatis dynamic SQL tags: Detailed explanation of Set tag usage MyBatis is an excellent persistence layer framework. It provides a wealth of dynamic SQL tags and can flexibly construct database operation statements. Among them, the Set tag is used to generate the SET clause in the UPDATE statement, which is very commonly used in update operations. This article will explain in detail the usage of the Set tag in MyBatis and demonstrate its functionality through specific code examples. What is Set tag Set tag is used in MyBati

How to install, uninstall, and reset Windows server backup How to install, uninstall, and reset Windows server backup Mar 06, 2024 am 10:37 AM

WindowsServerBackup is a function that comes with the WindowsServer operating system, designed to help users protect important data and system configurations, and provide complete backup and recovery solutions for small, medium and enterprise-level enterprises. Only users running Server2022 and higher can use this feature. In this article, we will explain how to install, uninstall or reset WindowsServerBackup. How to Reset Windows Server Backup If you are experiencing problems with your server backup, the backup is taking too long, or you are unable to access stored files, then you may consider resetting your Windows Server backup settings. To reset Windows

How to implement the WeChat clone function on Huawei mobile phones How to implement the WeChat clone function on Huawei mobile phones Mar 24, 2024 pm 06:03 PM

How to implement the WeChat clone function on Huawei mobile phones With the popularity of social software and people's increasing emphasis on privacy and security, the WeChat clone function has gradually become the focus of people's attention. The WeChat clone function can help users log in to multiple WeChat accounts on the same mobile phone at the same time, making it easier to manage and use. It is not difficult to implement the WeChat clone function on Huawei mobile phones. You only need to follow the following steps. Step 1: Make sure that the mobile phone system version and WeChat version meet the requirements. First, make sure that your Huawei mobile phone system version has been updated to the latest version, as well as the WeChat App.

See all articles