对DBA而言,不需要域就可以搭建SQL Server AlwaysOn是Windows Server 2016中最令人兴奋的功能了,它不仅可以降低搭建的成本,而且还减少了部署和运维的工作量。

上篇博客已给大家分享过:要在没有域的环境中搭建AlwaysOn需要两个步骤,

1).搭建基于windows server 2016 工作组环境的故障转移集群;

2).搭建AlwaysOn;

步骤1已在上篇博客中介绍了,因此本文将分享AlwaysOn的搭建方法:

1.安装SQL Server 2016

在所有节点上安装SQL Server 2016。

2.启用AlwaysOn功能

在所有节点上启用AlwaysOn功能,方法:

打开SQL Server配置管理器,在对应的SQL Server实例属性中,勾选【启用AlwaysOn可用性组】,如下图:

3.在每个节点上创建alwaysOn的通讯端点(镜像端点)

在windows server 2016之前,配置端点的加密的方式有两种:域用户授权和证书加密,升级到windows server 2016后,如果不使用域搭建AlwaysOn,那么就只能选择证书加密的方式了。

     3.1创建一个共享目录,允许AlwaysOn的所有节点均可以读写该目录;

共享目录用来存放端点通讯的证书,在后续的步骤中将会用到。示例为:\\WIN-JBRHIAJPMG2\file

     3.2创建端点

为了方便,我把创建证书和安装证书的过程用两个存储来实现。(这个两个存储过程来自网上,不是我写的)

  3.2.1将如下两个存储过程在每个节点的SQL Server实例中执行一遍:

CREATE PROCEDURE CreateEndpointCert
@ShareName SYSNAME ,
@StrongPassword SYSNAME
AS BEGIN --This must be executed in the context of Master
IF (DB_NAME() <> 'master')
BEGIN
PRINT N'This SP must be executed in master. USE master and then retry.'
RETURN (-1)
END DECLARE @DynamicSQL varchar(1000);
DECLARE @CompName varchar(250);
DECLARE @HasMasterKey INT;
SELECT @CompName = CONVERT(SysName, SERVERPROPERTY('MachineName')); -- Only create a master key if it doesn't already exist SELECT @HasMasterKey = is_master_key_encrypted_by_server from sys.databases where name = 'master'
IF (@HasMasterKey = 0)
BEGIN
--Create a MASTER KEY to encrypt the certificate.
SET @DynamicSQL = CONCAT('CREATE MASTER KEY ENCRYPTION BY PASSWORD = ' , QUOTENAME(@StrongPassword, ''''));
EXEC (@DynamicSQL)
END --Create the certificate to authenticate the endpoint
SET @DynamicSQL = CONCAT('CREATE CERTIFICATE ', QUOTENAME(@CompName + '-Certificate'), ' WITH SUBJECT = ', QUOTENAME(@CompName, ''''),',EXPIRY_DATE=',QUOTENAME(20991231 ,'''') )
EXEC (@DynamicSQL);

--Create the database mirroring endpoint authenticated by the certificate.
SET @DynamicSQL =
CONCAT('CREATE ENDPOINT Endpoint_Mirroring
STATE = STARTED
AS TCP (LISTENER_PORT = 5022, LISTENER_IP = ALL)
FOR DATABASE_MIRRORING (AUTHENTICATION = CERTIFICATE ',QUOTENAME(@CompName + '-Cert'), ' , ENCRYPTION = REQUIRED ALGORITHM AES, ROLE = ALL)');
EXEC (@DynamicSQL); --Back up the certificate to a common network share for import into other nodes in the cluster
SET @DynamicSQL = CONCAT('BACKUP CERTIFICATE ',QUOTENAME(@CompName + '-Cert'),' To FILE = ', QUOTENAME( @ShareName + '\SQL-' + @CompName + '.cer', ''''));
EXEC (@DynamicSQL);
END
GO

说明:

CreateEndpointCert 接受2个参数,分别为共享路径和证书密码,其作用:创建证书,创建基于证书加密通讯的端点,备份证书到共享路径;

CREATE PROCEDURE InstallEndpointCert
@CompName SYSNAME,
@ShareName SYSNAME,
@StrongPassword SYSNAME
AS BEGIN
DECLARE @DynamicSQL varchar(1000);
DECLARE @MyCompName varchar(250);
SELECT @MyCompName = CONVERT(SysName, SERVERPROPERTY('MachineName'));
--Don't need to create LOGINs for the local system
IF (@MyCompName <> @CompName)
BEGIN
SET @DynamicSQL = CONCAT('CREATE LOGIN ', QUOTENAME (@CompName + '-Login'), ' WITH PASSWORD= ', QUOTENAME( @StrongPassword, ''''));
EXEC (@DynamicSQL); SET @DynamicSQL = CONCAT('CREATE USER ', QUOTENAME( @CompName + '-User'), ' FOR LOGIN ', QUOTENAME(@CompName + '-Login'));
EXEC (@DynamicSQL); SET @DynamicSQL = CONCAT('CREATE CERTIFICATE ', QUOTENAME(@CompName +'-Cert'), ' AUTHORIZATION ', QUOTENAME(@CompName +'-User'), ' FROM FILE = ', QUOTENAME(@ShareName + '\SQL-' + @CompName + '.cer' , ''''));
EXEC (@DynamicSQL); SET @DynamicSQL = CONCAT('GRANT CONNECT ON ENDPOINT::Endpoint_Mirroring TO ', QUOTENAME(@CompName +'-Login'));
EXEC (@DynamicSQL);
END
END
GO

说明:

InstallEndpointCert  接受3个参数,分别为主机名、共享路径(必须跟CreateEndpointCert的共享路径相同)和密码。其作用:在SQL Server中为每个节点(除自身外)创建一个对应的登录用户和数据库用户(为了便于管理),然后利用共享路径中证书来授予该数据库用户可以访问对应节点的端点;

3.2.2 创建端点

首先依次在每个节点上执行CreateEndpointCert,创建证书,

然后在每个节点上执行InstallEndpointCert,InstallEndpointCert的第一个参数就是主机名,也就是说,除了自身外,需要将其他所有节点的主机名作为参数都执行一次InstallEndpointCert。

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAA6cAAAClCAIAAAAvXhyxAAAdYElEQVR4nO2dyZWrMBBFCYqMiIdw2P1InIz/gqlGSXhqY+5dcLpBSKXplVTGprsDAAAAAPw63V8bAAAAAADwdlj1AgAAAMDvw6oXAAAAAH4fVr0AAAAA8Puw6gUAAACA34dVLwAAAAD8Pqx6AQAAAOD3YdULAAAAAL8Pq14AAAAA+H1Y9QIAAADA78OqFwAAAAB+H1a9AAAAAPD7pKvef//+ceTIkSNHjhw5cuT45cdGiPUCwKU5pJgAAHBeKrFeAAAAAIDvhFgvAEAr7PABAC4CsV4AAAAAOCXEegEAWmGHDwBwEYj1AgAAAMApIdYLANAKO3wAgItArBcAAAAATgmxXgCAVtjhAwBcBGK9AAAAAHBKiPUCALTCDh8A4CIQ6wUAAACAU0KsFwCgFXb4AAAXgVgvAAAAAJwSYr0AAK2wwwcAuAjEegEAAADglBDrBQBohR0+AMBFINYLAAAAAKeEWO+1mIau67pumLYzt7Hvuq7r+vFmTg3Tmn69tqaV96vktXIX5vy23HaCPPSdMoW6Isw3CZzx5fKChIUcZAYle9St6po2Er4ddviw8Vdyem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Sg4vL3sxKnq3IJY1B5b8oXaErXDi2wJHN6etfGCpqfsmfW++TtB0/pY4NbzDRUp2I/Dg+dpf64XEUAEAODUNP6GQxabENGCTHjsE2DFWO8T6uXvDpzXG1a9idkPOLzkY9I4N/P5qHkST58vhnlCW1yXTMP6yWSyu0jjPbfl6bwtn3FS9jZUpLmPAF4AIqDOIwIA8NW85/d6b/ohq7t5/qqwXBXiVV716sXz/vs9bWgh9uZaW2wtgn/Fbxa5p+LMPc7s1OHZRrBGR8mc3TrSkRi2/yctnMS3Q/KNxpbrEraZgzP6E1j9C0tzLMeeWeq4Pcs3/yPzaKhI0X58HzxJMdaLCCACAPA7HHo3m/0cTyiVRaqQFt7CqldlZXXML1g16um0LPR8NNYrMhVnXS6B2bnDMw/wqdazTm095+0OWyovdE+uvv1dCq9Pg+9H/7xIOhS0HdoQOzoqFSnaj8ODF4MI6PIRAQD4Zt74brYHqS1Ym5j8W9XgESqheUXyRReAH+KCb19HBADgmhyK9f4lLHqfIPuUFgAuAiIAAL/J98V64c8RHyHi7QAk37bDfxeIAABcntPEegEAAAAAJMR6AQBaYYcPAHARiPUCAAAAwCkh1gsA0Ao7fACAi1CJ9XLkyJEjR44cOXLk+M3HRoj1AgAAAMDvw6oXAAAAAH4fVr0AAAAA8Puw6gUAAACA34dVLwAAAAD8Pqx6AQAAAOD3YdULAAAAAL8Pq14AAAAA+H1Y9QIAAADA7/Mfsfj0dIa6VpMAAAAASUVORK5CYII=" alt="" />

说明:

CreateEndpointCert 接受2个参数,分别为共享路径和证书密码,其作用:创建证书,创建基于证书加密通讯的端点,备份证书到共享路径;

InstallEndpointCert  接受3个参数,分别为主机名、共享路径(必须跟CreateEndpointCert的共享路径相同)和密码(数据库用户的密码)。

4.新建可用组

打开SSMS,登录到SQL Server,展开【AlwaysOn搞可用性】,根据向导创建AlwaysOn。

4.1指定可用组名称

4.2选择数据库

说明:在走AlwaysOn之前,数据库必须在完整模式下,且已经做过完整备份。

4.3指定副本,单击【添加副本】把所有的成员节点添加进来;

       4.3.1 添加副本

自动故障转移:运行在哪些节点间建立高可用(SQL Server 2016已经支持在3个节点了) 。

同步提交:AlwaysOn同步的模式,对应的还有异步模式,当选择了自动故障转移时,必须勾选同步提交;如想详细了解同步和异步模式的区别,可参考这个链接:http://www.cnblogs.com/i6first/p/4139670.html

可读辅助副本:当该节点为辅助副本时,能否接受只读请求以及以哪种方式接受只读请求(只读意向)。

4.3.2配置端点

步骤3中创建的端点在这里可以查看到:

4.3.3配置侦听器

4.4 选择数据同步的方式

我选择的是完整,指定了一个共享目录,在后面安装环节中,主副本会把数据库备份到这个位置,然后辅助副本从此位置拿到备份文件后还原,已实现数据同步。

4.5后面的【验证】、【摘要】直接选择Next(下一步)即可。

正常情况完成步骤4.5以后AlwaysOn就搭建完了,但我在两次实际验证过程中发现还需要继续后面的步骤,可能是我的环境的问题,请读者根据需要参考。

4.6将可用副本联机

在下图所示的位置,右击脱机的节点(红色向下的标记),选择联接到可用性组;

如何在没有域的环境中搭建AlwaysOn(二)的更多相关文章

  1. 如何在没有域的环境中搭建AlwaysOn(一)

    对DBA而言,不需要域就可以搭建SQL Server AlwaysOn是Windows Server 2016中最令人兴奋的功能了,它不仅可以降低搭建的成本,而且还减少了部署和运维的工作量. 该特性可 ...

  2. Idea开发环境中搭建Maven并且使用Maven打包部署程序

    1.配置Maven的环境变量 a.首先我们去maven官网下载Maven程序,解压到安装目录,如图所示: b.配置M2_HOME的环境变量,然后将该变量添加到Path中 备注:必须要有JAVA_HOM ...

  3. 如何在windows环境中搭建apache+subversion(ZT)

    我一直有一个想法就是在本机上象scm一样的搭建一个subversion服务器,然后每天写完代码的时候提交一下,这种感觉好好哦,之前我在windows环境中搭建过纯subversion的服务器兴奋过一阵 ...

  4. 在域信任环境中使用 Team Foundation Server (TFS 2013)

    原文:在域信任环境中使用 Team Foundation Server (TFS 2013) 1. 用户情景和方案: XX公司的大部分软件产品通过软件外包的方式由开发商完成.为加强对软件开发的进度和质 ...

  5. 2008R2域控环境中 应用组策略 实现禁用USB设备使用

    本文介绍如何在Windows Server 2008 AD中禁用客户端USB端口.本文使用的系统:Windows Server 2008 R2 企业版.域功能级别:Windows Server 200 ...

  6. Apache+MySQL+PHP开发环境的搭建(二)

    通过自主选择相应的apache,mysql,php等软件,根据自己的应用开发需求进行安装.此方法搭建的环境自主性较强,搭建过程较为复杂,繁琐. 1.所需软件: Apache: http-2.2.22- ...

  7. (4)ElasticSearch在linux环境中搭建集群

    1.概述 一个运行中的Elasticsearch实例称为一个节点(node),而集群是由一个或者多个拥有相同cluster.name配置的节点组成,它们共同承担数据和负载的压力.当有节点加入集群中或者 ...

  8. (1)Zookeeper在linux环境中搭建集群

    1.简介 ZooKeeper是Apache软件基金会的一个软件项目,它为大型分布式计算提供开源的分布式配置服务.同步服务和命名注册.ZooKeeper的架构通过冗余服务实现高可用性.Zookeeper ...

  9. helm在kubernetes环境中搭建

    1.安装helm 1.1.安装helm客户端 各个版本的helm:https://github.com/helm/helm/releases wget https://get.helm.sh/helm ...

随机推荐

  1. 安装sqoop

    安装sqoop 1.默认已经安装好java+hadoop 2.下载对应hadoop版本的sqoop版本 3.解压安装包 tar zxvf sqoop-1.4.6.bin__hadoop-2.0.4-a ...

  2. Android自定义组件

    [参考的原文地址] http://blog.csdn.net/l1028386804/article/details/47101387效果图: 实现方式: 一:自定义一个含有EditText和Butt ...

  3. 6种方法实现asp.net返回上一页

    其实要实现返回上一页的功能,主要还是要用到JavaScript. 一: 在ASP.net的aspx里面的源代码中 <input type="button onclick="J ...

  4. 【转载】AB测试结果分析

    AB测试,200个请求,20个并发.这样的测试强度,CPU占了70-80%,w3p占用了70多M内存,本想多测几次,看看它的内存会不会涨上去,没 有测试机器没办法,开发机要干活.我估计CPU就有问题了 ...

  5. Logical query-processing phases

    Logical query-processing phases in brief (1) FROM This phase identifies the query’s source tables an ...

  6. 我的Windows Phone 8

    学习Windows Phone 8开发,将自己收集到的学习资料做一个汇总(不断更新). 我的Windows Phone应用 DotaMax MyAppToStart 麦子学院 WP8.1版(UI简陋) ...

  7. 图片Base64编码

    我们经常在做Jquery插件的时候需要插入一些自定义的控件,比如说按钮,而我们自己又觉着button标签很丑,而且不同浏览器显示的效果还不一样,这个时候我们需要用到图片,当然,我们可以通过img标签添 ...

  8. Js的typeof和Js的基本数据类型

    本文将从以下几个方面介绍Js的typeof和Js的基本数据类型: ** Js的typeof的用法 ** Js的基本数据类型 ** 使用基本类型使用typeof的返回结果 ** Js的typeof的用法 ...

  9. Storm 中什么是-acker,acker工作流程介绍

    概述 我们知道storm一个很重要的特性是它能够保证你发出的每条消息都会被完整处理, 完整处理的意思是指: 一个tuple被完全处理的意思是: 这个tuple以及由这个tuple所导致的所有的tupl ...

  10. Linux Shell 编程中的特殊符号

    一.井号 # 1.在脚本文件中对一行进行注释. 2.在引号和\符号后不是注释,只是#号本身: echo "12 # hehe" echo '12 # hehe' echo 12 \ ...