Skip to content

Commit 6f1e103

Browse files
authored
Merge pull request #25244 from rwestMSFT/rw-1214-linux-dh2i
Refresh cross-platform AG article, add DH2i link
2 parents 6a06ff3 + 74ebebe commit 6f1e103

6 files changed

Lines changed: 89 additions & 86 deletions

File tree

Binary file not shown.

docs/linux/media/sql-server-linux-availability-group-cross-platform/3-cert-key-owner-group.png renamed to docs/linux/media/sql-server-linux-availability-group-cross-platform/certificate-key-owner-group.png

File renamed without changes.
5.18 KB
Loading
33.8 KB
Loading
Lines changed: 89 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,77 @@
11
---
2-
title: Configure SQL Server Always On Availability Group on Windows and Linux
2+
title: Configure SQL Server Always On availability group on Windows and Linux
33
description: Learn how to create a SQL Server Always On Availability Group (AG) with one replica on a Windows server and the other replica on a Linux server.
44
author: VanMSFT
55
ms.author: vanto
6-
ms.reviewer: vanto
7-
ms.date: 01/31/2018
8-
ms.topic: conceptual
6+
ms.reviewer: vanto, randolphwest
7+
ms.date: 12/14/2022
98
ms.service: sql
109
ms.subservice: linux
11-
ms.assetid:
10+
ms.topic: conceptual
1211
monikerRange: ">= sql-server-2017"
1312
---
14-
# Configure SQL Server Always On Availability Group on Windows and Linux (cross-platform)
13+
# Configure SQL Server Always On availability group on Windows and Linux (cross-platform)
1514

1615
[!INCLUDE[tsql-appliesto-sslinux-only](../includes/applies-to-version/sqlserver2017.md)]
1716

18-
This article explains the steps to create an Always On Availability Group (AG) with one replica on a Windows server and the other replica on a Linux server. This configuration is cross-platform because the replicas are on different operating systems. Use this configuration for migration from one platform to the other or disaster recovery (DR). This configuration does not support high-availability because there is no cluster solution to manage a cross-platform configuration.
17+
This article explains the steps to create an Always On availability group (AG) with one replica on a Windows server and the other replica on a Linux server.
18+
19+
> [!IMPORTANT]
20+
> [!INCLUDE [ssnoversion-md](../includes/ssnoversion-md.md)] cross-platform availability groups, which include heterogeneous replicas with complete high-availability and disaster recovery support, is available with DH2i DxEnterprise. For more information, see [SQL Server Availability Groups with Mixed Operating Systems](https://support.dh2i.com/docs/guides/dxenterprise/sql_server/mssql-ag-mixed-os-qsg).
1921
20-
![Hybrid None](./media/sql-server-linux-availability-group-overview/image1.png)
22+
This configuration is cross-platform because the replicas are on different operating systems. Use this configuration for migration from one platform to the other or disaster recovery (DR). This configuration doesn't support high availability.
2123

22-
Before proceeding, you should be familiar with installation and configuration for SQL Server instances on Windows and Linux.
24+
:::image type="content" source="media/sql-server-linux-availability-group-cross-platform/cluster-type-none.png" alt-text="Diagram of Availability group with cluster type of None.":::
25+
26+
Before proceeding, you should be familiar with installation and configuration for SQL Server instances on Windows and Linux.
2327

2428
## Scenario
2529

26-
In this scenario, two servers are on different operating systems. A Windows Server 2016 named `WinSQLInstance` hosts the primary replica. A Linux server named `LinuxSQLInstance` host the secondary replica.
30+
In this scenario, two servers are on different operating systems. A Windows Server 2022 named `WinSQLInstance` hosts the primary replica. A Linux server named `LinuxSQLInstance` host the secondary replica.
2731

28-
## Configure the AG
32+
## Configure the AG
2933

30-
The steps to create the AG are the same as the steps to create an AG for read-scale workloads. The AG cluster type is NONE, because there is no cluster manager.
34+
The steps to create the AG are the same as the steps to create an AG for [read-scale workloads](sql-server-linux-availability-group-configure-rs.md). The AG cluster type is NONE, because there is no cluster manager.
3135

32-
>[!NOTE]
33-
>For the scripts in this article, angle brackets `<` and `>` identify values that you need to replace for your environment. The angle brackets themselves are not required for the scripts.
36+
> [!NOTE]
37+
> For the scripts in this article, angle brackets `<` and `>` identify values that you need to replace for your environment. The angle brackets themselves are not required for the scripts.
3438
35-
1. Install SQL Server 2017 on Windows Server 2016, enable Always On Availability Groups from SQL Server Configuration Manager, and set mixed mode authentication.
39+
1. Install [!INCLUDE [sssql22-md](../includes/sssql22-md.md)] on Windows Server 2022, enable **Always On Availability Groups** from SQL Server Configuration Manager, and set mixed mode authentication.
3640

37-
>[!TIP]
38-
>If you are validating this solution in Azure, place both servers in the same availability set to ensure they are separated in the data center.
41+
> [!TIP]
42+
> If you are validating this solution in Azure, place both servers in the same availability set to ensure they are separated in the data center.
3943
4044
**Enable Availability Groups**
4145

4246
For instructions, see [Enable and disable Always On Availability Groups (SQL Server)](../database-engine/availability-groups/windows/enable-and-disable-always-on-availability-groups-sql-server.md).
4347

44-
![Enable Availability Groups](./media/sql-server-linux-availability-group-cross-platform/1-sqlserver-configuration-manager.png)
48+
:::image type="content" source="./media/sql-server-linux-availability-group-cross-platform/configuration-manager.png" alt-text="Screenshot showing how to enable Availability Groups.":::
4549

46-
SQL Server Configuration Manager notes that the computer is not a node in a failover cluster.
50+
SQL Server Configuration Manager notes that the computer isn't a node in a failover cluster.
4751

4852
After you enable Availability Groups, restart SQL Server.
4953

5054
**Set mixed mode authentication**
5155

5256
For instructions, see [Change server authentication mode](../database-engine/configure-windows/change-server-authentication-mode.md#change-authentication-mode-with-ssms).
5357

54-
1. Install SQL Server 2017 on Linux. For instructions, see [Install SQL Server](sql-server-linux-setup.md). Enable `hadr` via mssql-conf.
58+
1. Install [!INCLUDE [sssql22-md](../includes/sssql22-md.md)] on Linux. For instructions, see [Install SQL Server](sql-server-linux-setup.md). Enable `hadr` with **mssql-conf**.
5559

56-
To enable `hadr` via mssql-conf from a shell prompt, issue the following command:
60+
To enable `hadr` via **mssql-conf** from a shell prompt, issue the following command:
5761

5862
```bash
5963
sudo /opt/mssql/bin/mssql-conf set hadr.hadrenabled 1
6064
```
6165

62-
After you enable `hadr`, restart the SQL Server instance.
63-
64-
The following image shows this complete step.
66+
After you enable `hadr`, restart the SQL Server instance:
6567

66-
![Screenshot of a Git Bash window showing the command.](./media/sql-server-linux-availability-group-cross-platform/2-sqlserver-linux-set-hadr.png)
68+
```bash
69+
sudo systemctl restart mssql-server.service
70+
```
6771

68-
1. Configure hosts file on both servers or register the server names with DNS.
72+
1. Configure the `hosts` file on both servers, or register the server names with DNS.
6973

70-
1. Open up firewall ports for TPC 1433 and 5022 on both Windows and Linux.
74+
1. Open up firewall ports for TCP 1433 and 5022 on both Windows and Linux.
7175

7276
1. On the primary replica, create a database login and password.
7377

@@ -83,19 +87,19 @@ The steps to create the AG are the same as the steps to create an AG for read-sc
8387
CREATE MASTER KEY ENCRYPTION BY PASSWORD = '<C0m9L3xP@55w0rd!>';
8488
CREATE CERTIFICATE dbm_certificate WITH SUBJECT = 'dbm';
8589
BACKUP CERTIFICATE dbm_certificate
86-
TO FILE = 'C:\Program Files\Microsoft SQL Server\MSSQL14.MSSQLSERVER\MSSQL\DATA\dbm_certificate.cer'
90+
TO FILE = 'C:\Program Files\Microsoft SQL Server\MSSQL16.MSSQLSERVER\MSSQL\DATA\dbm_certificate.cer'
8791
WITH PRIVATE KEY (
88-
FILE = 'C:\Program Files\Microsoft SQL Server\MSSQL14.MSSQLSERVER\MSSQL\DATA\dbm_certificate.pvk',
92+
FILE = 'C:\Program Files\Microsoft SQL Server\MSSQL16.MSSQLSERVER\MSSQL\DATA\dbm_certificate.pvk',
8993
ENCRYPTION BY PASSWORD = '<C0m9L3xP@55w0rd!>'
9094
);
9195
GO
9296
```
9397

94-
1. Copy the certificate and private key to the Linux server (secondary replica) at `/var/opt/mssql/data`. You can use `pscp` to copy the files to the Linux server.
98+
1. Copy the certificate and private key to the Linux server (secondary replica) at `/var/opt/mssql/data`. You can use `pscp` to copy the files to the Linux server.
9599

96100
1. Set the group and ownership of the private key and the certificate to `mssql:mssql`.
97101

98-
The following script sets the group and ownership of the files.
102+
The following script sets the group and ownership of the files.
99103

100104
```bash
101105
sudo chown mssql:mssql /var/opt/mssql/data/dbm_certificate.pvk
@@ -104,8 +108,7 @@ The steps to create the AG are the same as the steps to create an AG for read-sc
104108

105109
In the following diagram, ownership and group are set correctly for the certificate and key.
106110

107-
![Screenshot of a Git Bash window showing the .cer and the .pvk in the /var/opt/mssql/data folder.](./media/sql-server-linux-availability-group-cross-platform/3-cert-key-owner-group.png)
108-
111+
:::image type="content" source="./media/sql-server-linux-availability-group-cross-platform/certificate-key-owner-group.png" alt-text="Screenshot of a Git Bash window showing the .cer and the .pvk in the /var/opt/mssql/data folder.":::
109112

110113
1. On the secondary replica, create a database login and password and create a master key.
111114

@@ -117,10 +120,10 @@ The steps to create the AG are the same as the steps to create an AG for read-sc
117120
GO
118121
```
119122

120-
1. On the secondary replica, restore the certificate you copied to `/var/opt/mssql/data`.
123+
1. On the secondary replica, restore the certificate you copied to `/var/opt/mssql/data`.
121124

122125
```sql
123-
CREATE CERTIFICATE dbm_certificate
126+
CREATE CERTIFICATE dbm_certificate
124127
AUTHORIZATION dbm_user
125128
FROM FILE = '/var/opt/mssql/data/dbm_certificate.cer'
126129
WITH PRIVATE KEY (
@@ -141,106 +144,106 @@ The steps to create the AG are the same as the steps to create an AG for read-sc
141144
ENCRYPTION = REQUIRED ALGORITHM AES
142145
);
143146
ALTER ENDPOINT [Hadr_endpoint] STATE = STARTED;
144-
GRANT CONNECT ON ENDPOINT::[Hadr_endpoint] TO [dbm_login]
147+
GRANT CONNECT ON ENDPOINT::[Hadr_endpoint] TO [dbm_login];
145148
GO
146149
```
147150

148-
>[!IMPORTANT]
149-
>The firewall must be open for the listener TCP port. In the preceding script, the port is 5022. Use any available TCP port.
151+
> [!IMPORTANT]
152+
> The firewall must be open for the listener TCP port. In the preceding script, the port is 5022. Use any available TCP port.
150153
151-
1. On the secondary replica, create the endpoint. Repeat the preceding script on the secondary replica to create the endpoint.
154+
1. On the secondary replica, create the endpoint. Repeat the preceding script on the secondary replica to create the endpoint.
152155

153-
1. On the primary replica, create the AG with `CLUSTER_TYPE = NONE`. The example script uses `SEEDING_MODE = AUTOMATIC` to create the AG.
156+
1. On the primary replica, create the AG with `CLUSTER_TYPE = NONE`. The example script uses `SEEDING_MODE = AUTOMATIC` to create the AG.
154157

155-
>[!NOTE]
156-
>When the Windows instance of SQL Server uses different paths for data and log files, automatic seeding fails to the Linux instance of SQL Server because these paths do not exist on the secondary replica. To use the following script for a cross-platform AG, the database requires the same path for the data and log files on the Windows server. Alternatively you can update the script to set `SEEDING_MODE = MANUAL` and then back up and restore the database with `NORECOVERY` to seed the database.
158+
> [!NOTE]
159+
> When the Windows instance of SQL Server uses different paths for data and log files, automatic seeding fails to the Linux instance of SQL Server, because these paths do not exist on the secondary replica. To use the following script for a cross-platform AG, the database requires the same path for the data and log files on the Windows server. Alternatively you can update the script to set `SEEDING_MODE = MANUAL` and then back up and restore the database with `NORECOVERY` to seed the database.
157160
>
158-
>This behavior applies to Azure Marketplace images.
161+
> This behavior applies to Azure Marketplace images.
159162
>
160-
>For more information about automatic seeding, see [Automatic Seeding - Disk Layout](../database-engine/availability-groups/windows/automatic-seeding-secondary-replicas.md#disklayout).
163+
> For more information about automatic seeding, see [Automatic Seeding - Disk Layout](../database-engine/availability-groups/windows/automatic-seeding-secondary-replicas.md#disklayout).
161164
162165
Before you run the script, update the values for your AGs.
163166

164-
* Replace `<WinSQLInstance>` with the server name of the primary replica SQL Server instance.
167+
- Replace `<WinSQLInstance>` with the server name of the primary replica SQL Server instance.
165168

166-
* Replace `<LinuxSQLInstance>` with the server name of the secondary replica SQL Server instance.
169+
- Replace `<LinuxSQLInstance>` with the server name of the secondary replica SQL Server instance.
167170

168-
To create the AG, update the values and run the script on the primary replica.
171+
To create the AG, update the values and run the script on the primary replica.
169172

170173
```sql
171-
CREATE AVAILABILITY GROUP [ag1]
172-
WITH (CLUSTER_TYPE = NONE)
173-
FOR REPLICA ON
174-
N'<WinSQLInstance>'
175-
WITH (
176-
ENDPOINT_URL = N'tcp://<WinSQLInstance>:5022',
177-
AVAILABILITY_MODE = ASYNCHRONOUS_COMMIT,
178-
SEEDING_MODE = AUTOMATIC,
179-
FAILOVER_MODE = MANUAL,
180-
SECONDARY_ROLE (ALLOW_CONNECTIONS = ALL)
181-
),
182-
N'<LinuxSQLInstance>'
183-
WITH (
184-
ENDPOINT_URL = N'tcp://<LinuxSQLInstance>:5022',
185-
AVAILABILITY_MODE = ASYNCHRONOUS_COMMIT,
186-
SEEDING_MODE = AUTOMATIC,
187-
FAILOVER_MODE = MANUAL,
188-
SECONDARY_ROLE (ALLOW_CONNECTIONS = ALL)
189-
)
174+
CREATE AVAILABILITY
175+
GROUP [ag1]
176+
WITH (CLUSTER_TYPE = NONE)
177+
FOR REPLICA
178+
ON N'<WinSQLInstance>'
179+
WITH (
180+
ENDPOINT_URL = N'tcp://<WinSQLInstance>:5022',
181+
AVAILABILITY_MODE = ASYNCHRONOUS_COMMIT,
182+
SEEDING_MODE = AUTOMATIC,
183+
FAILOVER_MODE = MANUAL,
184+
SECONDARY_ROLE(ALLOW_CONNECTIONS = ALL)
185+
),
186+
N'<LinuxSQLInstance>'
187+
WITH (
188+
ENDPOINT_URL = N'tcp://<LinuxSQLInstance>:5022',
189+
AVAILABILITY_MODE = ASYNCHRONOUS_COMMIT,
190+
SEEDING_MODE = AUTOMATIC,
191+
FAILOVER_MODE = MANUAL,
192+
SECONDARY_ROLE(ALLOW_CONNECTIONS = ALL);
193+
)
190194
GO
191195
```
192-
196+
193197
For more information, see [CREATE AVAILABILITY GROUP (Transact-SQL)](../t-sql/statements/create-availability-group-transact-sql.md).
194198

195199
1. On the secondary replica, join the AG.
196200

197201
```sql
198-
ALTER AVAILABILITY GROUP [ag1] JOIN WITH (CLUSTER_TYPE = NONE)
199-
ALTER AVAILABILITY GROUP [ag1] GRANT CREATE ANY DATABASE
202+
ALTER AVAILABILITY GROUP [ag1] JOIN WITH (CLUSTER_TYPE = NONE);
203+
ALTER AVAILABILITY GROUP [ag1] GRANT CREATE ANY DATABASE;
200204
GO
201205
```
202206

203-
1. Create a database for the AG. The example steps use a database named `<TestDB>`. If you are using automatic seeding, set the same path for both the data and the log files.
207+
1. Create a database for the AG. The example steps use a database named `TestDB`. If you are using automatic seeding, set the same path for both the data and the log files.
204208

205209
Before you run the script, update the values for your database.
206210

207-
* Replace `<TestDB>` with the name of your database.
211+
- Replace `TestDB` with the name of your database.
208212

209-
* Replace `<F:\Path>` with the path for your database and log files. Use the same path for the database and log files.
213+
- Replace `<F:\Path>` with the path for your database and log files. Use the same path for the database and log files.
210214

211-
You can also use the default paths.
215+
You can also use the default paths.
212216

213-
To create your database, run the script.
217+
To create your database, run the script.
214218

215219
```sql
216-
CREATE DATABASE [<TestDB>]
220+
CREATE DATABASE [TestDB]
217221
CONTAINMENT = NONE
218-
ON PRIMARY ( NAME = N'<TestDB>', FILENAME = N'<F:\Path>\<TestDB>.mdf')
219-
LOG ON ( NAME = N'<TestDB>_log', FILENAME = N'<F:\Path>\<TestDB>_log.ldf')
222+
ON PRIMARY ( NAME = N'TestDB', FILENAME = N'<F:\Path>\TestDB.mdf')
223+
LOG ON ( NAME = N'TestDB_log', FILENAME = N'<F:\Path>\TestDB_log.ldf');
220224
GO
221225
```
222226

223-
1. Take a full backup of the database.
227+
1. Take a full backup of the database.
224228

225-
1. If you are not using automatic seeding, restore the database on the secondary replica (Linux) server. [Migrate a SQL Server database from Windows to Linux using backup and restore](sql-server-linux-migrate-restore-database.md). Restore the database `WITH NORECOVERY` on the secondary replica.
229+
1. If you aren't using automatic seeding, restore the database on the secondary replica (Linux) server. [Migrate a SQL Server database from Windows to Linux using backup and restore](sql-server-linux-migrate-restore-database.md). Restore the database `WITH NORECOVERY` on the secondary replica.
226230

227-
1. Add the database to the AG. Update the example script. Replace `<TestDB>` with the name of your database. On the primary replica, run the SQL query to add the database to the AG.
231+
1. Add the database to the AG. Update the example script. Replace `TestDB` with the name of your database. On the primary replica, run the T-SQL query to add the database to the AG.
228232

229233
```sql
230-
ALTER AG [ag1] ADD DATABASE <TestDB>
234+
ALTER AG [ag1] ADD DATABASE TestDB;
231235
GO
232236
```
233237

234-
1. Verify that the database is getting populated on the secondary replica.
238+
1. Verify that the database is getting populated on the secondary replica.
235239

236240
## Fail over the primary replica
237241

238242
[!INCLUDE[Force failover](../includes/ss-force-failover-read-scale-out.md)]
239243

240-
This article reviewed the steps to create a cross-platform AG to support migration or read-scale workloads. It can be used for manual disaster recovery. It also explained how to fail over the AG. A cross-platform AG uses cluster type `NONE` and does not support high availability because there is no cluster tool across-platforms.
244+
This article reviewed the steps to create a cross-platform AG to support migration or read-scale workloads. It can be used for manual disaster recovery. It also explained how to fail over the AG. A cross-platform AG uses cluster type `NONE` and doesn't support high availability.
241245

242246
## Next steps
243247

244-
[Overview of Always On Availability Groups](../database-engine/availability-groups/windows/overview-of-always-on-availability-groups-sql-server.md)
245-
246-
[SQL Server availability basics for Linux deployments](sql-server-linux-ha-basics.md)
248+
- [Overview of Always On Availability Groups](../database-engine/availability-groups/windows/overview-of-always-on-availability-groups-sql-server.md)
249+
- [SQL Server availability basics for Linux deployments](sql-server-linux-ha-basics.md)

0 commit comments

Comments
 (0)