SQLServer 2012 Always on配置全过程
可用性组在可用性副本级别进行故障转移。 故障转移不是由诸如因数据文件丢失或事务日志损坏而使数据库成为可疑数据库等数据库问题导致的。 因此,一个辅助数据库可以挂起或失败而不会影响其他辅助数据库,一个主数据库可以挂起或失败而不会影响其他主数据库
可用性组在可用性副本级别进行故障转移。故障转移不是由诸如因数据文件丢失或事务日志损坏而使数据库成为可疑数据库等数据库问题导致的。
因此,一个辅助数据库可以挂起或失败而不会影响其他辅助数据库,一个主数据库可以挂起或失败而不会影响其他主数据库。
图显示一个可用性组,该组包含最大数目的可用性副本,即一个主副本和四个辅助副本。
来自:
虽然2012 Always on是基于WSFC的,但是并不需要共享存储,所以配置就非常简单。
下面是我的安装步骤:
至少需要三台机器(我创建了三台虚拟机,一台是作为DC,DNS服务器,香港虚拟主机,两台Nod3)
(备注:为啥一定要3台,网站空间,因为SQL SERVER 的 Cluster服务不能安装在域服务器上。Windows2008 R2 和SQL SERVER 2012 一定要打上sp1.否则有不可预知的错误)
机器名
角色
OS
IP Address
DC
Domain Controller
Windows 2008R2
192.168.1.10
Node1
Cluster Node 1
Windows 2008R2
192.168.1.11 Public
192.168.2.1
心跳线
Node2
Cluster Node 2
Windows 2008R2
192.168.1.12 Public
192.168.2.2
心跳线窗体底端
首先配置Windows集群:
1. 安装.NETFramework 3.5.1 Features和Failover Clustering
2. 安装Windows KB 2494036
3.新建集群
4.选择加入集群的服务器:
5.检测配置:
6.不需要选择检测共享磁盘(AlwaysOn不需要)
7.开始检测:
8.检测内容(检测完成后可以导出Report):
9.之后输入Cluster名字和IP点击下一步创建成功,成功后打开Server Manager查看集群配置(可以看到并没有共享磁盘,跟传统的集群还是有区别的):
现在我们集群已经配置后了,下一步是安装SQLServer并且配置Always On.
我们已经配置了Cluster,Part2 我们安装SQL Server 2012 评估版(要使用64位的SQLServer, X86不支持Always On)并且配置Alaways On Group.
1. 以管理员身份安装
2.选择单机安装(不是集群安装)
3.SQL Server 2012的新功能,可以在安装的时候搜索最新的补丁,将补丁也以前安装(这个是可选项)
4.规则检测
5.选择安装组件
6.实例名:
7.计算需要的磁盘空间:
8.Service账户(域账户):
9.排序规则(可以根据自己需要选择):
10.设置权限,数据库文件备份地址以及Filestream选项:
11.安装后需要重新启动(可以查看安装日志):
12.在ConfigurationManager中对SQL Server开启Always OnHigh Availability(可以自动检测到前面我们创建的Cluster名字)
设置更改后需要重启Service.现在一切都具备了,虚拟主机,我们可以配置Always On group了。
1.创建新的可用性组(可用性组向导,也可以用下面的选型):
2.输入可用性组的名字:
3.选择组中的数据库:
4.Replica 选择Node2(选择自动Failover/可读数据库):
5.点击下一步,Node1将会备份数据库到Share Folder然后还原到Node2做同步 (Node1为主,Node2为辅助)
下一步就是测试Node2数据可读已经Failover.
可用性组我们已经创建成功了,现在测试一下Node2 上读取数据以及Failover.
1. 数据测据:Node1上创建表test插入记录
在Node2上访问test数据库,数据可以查到(在Mirror中是不可以查询的,而且数据同步不会导致Node2的连接断掉):
2. Failover测试:
连接到Node2:
Failover后(Primary已经变成Node2):
可以看到Always On group 既保证了高可用性,有可以实现同步数据库的只读访问,提供了硬件的利用率,非常给力的一个功能。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

For objects with the same name that already exist in the SQL Server database, the following steps need to be taken: Confirm the object type (table, view, stored procedure). IF NOT EXISTS can be used to skip creation if the object is empty. If the object has data, use a different name or modify the structure. Use DROP to delete existing objects (use caution, backup recommended). Check for schema changes to make sure there are no references to deleted or renamed objects.

The import steps are as follows: Copy the MDF file to SQL Server's data directory (usually C:\Program Files\Microsoft SQL Server\MSSQL\DATA). In SQL Server Management Studio (SSMS), open the database and select Attach. Click the Add button and select the MDF file. Confirm the database name and click the OK button.

When the SQL Server service fails to start, here are some steps to resolve: Check the error log to determine the root cause. Make sure the service account has permission to start the service. Check whether dependency services are running. Disable antivirus software. Repair SQL Server installation. If the repair does not work, reinstall SQL Server.

To view the SQL Server port number: Open SSMS and connect to the server. Find the server name in Object Explorer, right-click it and select Properties. In the Connection tab, view the TCP Port field.

SQL Server database files are usually stored in the following default location: Windows: C:\Program Files\Microsoft SQL Server\MSSQL\DATALinux: /var/opt/mssql/data The database file location can be customized by modifying the database file path setting.

If you accidentally delete a SQL Server database, you can take the following steps to recover: stop database activity; back up log files; check database logs; recovery options: restore from backup; restore from transaction log; use DBCC CHECKDB; use third-party tools. Please back up your database regularly and enable transaction logging to prevent data loss.

If the SQL Server installation fails, you can clean it up by following these steps: Uninstall SQL Server Delete registry keys Delete files and folders Restart the computer

SQL Server English installation can be changed to Chinese by following the following steps: download the corresponding language pack; stop the SQL Server service; install the language pack; change the instance language; change the user interface language; restart the application.
