标签:ref ip地址 enter session 备份文件 www. prim com 比较
之前和很多群友聊天发现对2016的无域和负载均衡满心期待,毕竟可以简单搭建而且可以不适用第三方负载均衡器,SQL自己可以负载了。windows2016已经可以下载使用了,那么这回终于可以揭开令人憧憬向往的AlwaysOn2016 负载均衡集群的神秘面纱了。
本篇主要描述个人集群搭建中遇到的坑和一些注意事项,以及2016无域负载均衡的简单体验测试。
想要不使用域环境来搭建AlwaysON 必须使用windows 2016 和sql server2016
本篇我使用3台虚拟机(主要是为了测试负载均衡,否则2台就可以),为了搭建的纯洁性,我3台机器都是独立安装,没有使用虚机复制。
主机名 | IP地址 |
sql16node1 | 192.168.3.113 |
sql16node2 | 192.168.3.114 |
sql16node3 | 192.168.3.115 |
sqlcluster2016(windows集群) | 192.168.3.120 |
L_KK_AWO2016(AlwaysOn监听) | 192.168.3.121 |
16操作系统介质 |
ed2k://|file|cn_windows_server_2016_x64_dvd_9327743.iso|6020876288|58F585A340248EF7603A48F832F08B6D|/ |
SQL16介质 |
ed2k://|file|cn_sql_server_2016_enterprise_x64_dvd_8699450.iso|2452795392|D8AFD8D6245F518F53F720C48E2819C0|/ |
整体的系统,故障转移集群,AlwaysOn搭建都和2012和2014没有太大差别,所以这里只介绍几个搭建时的特殊注意点。
1.因为没有域所以需要在”计算机属性“添加计算机的DNS后缀。
2.需要做域名解析(域名解析运行——>drivers,每个节点都需要配置)
3.图形化创建会出现问题,导出脚本查看发现脚本不全
下面是创建AWO的脚本(前提是各个节点已经还原的备份文件)
注: 以下脚本可以通过SSMS工具切换到SQLCMD模式运行
--- YOU MUST EXECUTE THE FOLLOWING SCRIPT IN SQLCMD MODE.
:Connect sql16node1
IF (SELECT state FROM sys.endpoints WHERE name = N‘Hadr_endpoint‘) <> 0
BEGIN
ALTER ENDPOINT [Hadr_endpoint] STATE = STARTED
END
GO
use [master]
GO
GRANT CONNECT ON ENDPOINT::[Hadr_endpoint] TO [NT Service\MSSQLSERVER]
GO
:Connect sql16node1
IF EXISTS(SELECT * FROM sys.server_event_sessions WHERE name=‘AlwaysOn_health‘)
BEGIN
ALTER EVENT SESSION [AlwaysOn_health] ON SERVER WITH (STARTUP_STATE=ON);
END
IF NOT EXISTS(SELECT * FROM sys.dm_xe_sessions WHERE name=‘AlwaysOn_health‘)
BEGIN
ALTER EVENT SESSION [AlwaysOn_health] ON SERVER STATE=START;
END
GO
:Connect sql16node2
IF (SELECT state FROM sys.endpoints WHERE name = N‘Hadr_endpoint‘) <> 0
BEGIN
ALTER ENDPOINT [Hadr_endpoint] STATE = STARTED
END
GO
use [master]
GO
GRANT CONNECT ON ENDPOINT::[Hadr_endpoint] TO [NT Service\MSSQLSERVER]
GO
:Connect sql16node2
IF EXISTS(SELECT * FROM sys.server_event_sessions WHERE name=‘AlwaysOn_health‘)
BEGIN
ALTER EVENT SESSION [AlwaysOn_health] ON SERVER WITH (STARTUP_STATE=ON);
END
IF NOT EXISTS(SELECT * FROM sys.dm_xe_sessions WHERE name=‘AlwaysOn_health‘)
BEGIN
ALTER EVENT SESSION [AlwaysOn_health] ON SERVER STATE=START;
END
GO
:Connect sql16node3
IF (SELECT state FROM sys.endpoints WHERE name = N‘Hadr_endpoint‘) <> 0
BEGIN
ALTER ENDPOINT [Hadr_endpoint] STATE = STARTED
END
GO
use [master]
GO
GRANT CONNECT ON ENDPOINT::[Hadr_endpoint] TO [NT Service\MSSQLSERVER]
GO
:Connect sql16node3
IF EXISTS(SELECT * FROM sys.server_event_sessions WHERE name=‘AlwaysOn_health‘)
BEGIN
ALTER EVENT SESSION [AlwaysOn_health] ON SERVER WITH (STARTUP_STATE=ON);
END
IF NOT EXISTS(SELECT * FROM sys.dm_xe_sessions WHERE name=‘AlwaysOn_health‘)
BEGIN
ALTER EVENT SESSION [AlwaysOn_health] ON SERVER STATE=START;
END
GO
:Connect sql16node1
USE [master]
GO