Enable AlwaysOn
In SQL Server Configuration Manager on the SQL01 and SQL02 servers, right-click the SQL Server service select Properties
In the AlwaysOn High Availability tab, you can see that Windows Failover Cluster name is the Sqlalwayson cluster created previously, tick enable AlwaysOn availability Groups
Restart SQL Server Services
2. Create a test database
CREATE DATABASE [always_test_1]
Containment = NONE
On PRIMARY
(NAME = n ' always_test_1 ', FILENAME = N ' C:\sql01\Always_test_1.mdf ', SIZE = 3072KB, MAXSIZE = UNLIMITED, filegrowth = 10 24KB)
LOG on
(NAME = n ' always_test_1_log ', FILENAME = N ' C:\sql01\Always_test_1_log.ldf ', SIZE = 1024KB, MAXSIZE = 2048GB, filegrowt H = 10%)
GO
Configure AlwaysOn High Availability
Click New Availability Group Wizard ...
Availability Group Name:sql_ag
Here the database check compliance is configured with the AG condition
BACKUP DATABASE always_test_1 to disk= ' C:\sql01\Always_test_1_full.bak '
When you are done, click Refresh
Tick Click Next
Click Add Replica ... Connection sql02,sql01/sql02 tick options and configuration as above, endpoints default (if multiple NICs, need to be configured for specific IP)
Select Full Auto-sync data (select Join only needs to restore SQL01 in sql02 and log backups, and the Restore option is NORECOVERY), configure the Quorum folder as the transfer path
Validation fails, you need to create a directory of C:\SQL01 recovery data above sql02, and click Re-run after creation Validation
After the connection Sql01,sql02,alwayson configuration is successful, the following
Create Availability Group Listener
Listener DNS Name:sqllistener
port:1433
Network mode:static IP
IP address:192.168.0.111
Use the Sqllistener connection as follows
Inspection configuration
After the configuration is complete, the DC AD computers is as follows
DNS is as follows
Failover Cluster Manager is as follows
Fail-over Test
Simulation of downtime, sql01 shutdown, SQL01 display as down state (there is a downward arrow), primary automatically transferred to SQL02, as follows
Sql01 re-boot, secondary recovery, as follows
After sql02 shutdown, the primary automatically transfers to SQL01, as follows
SQL Server AlwaysOn Build five: AlwaysOn configuration