Skip to content

Commit 569cdf0

Browse files
authored
Merge pull request #77866 from ajlam/mariadb-replica
MariaDB same region replica preview
2 parents bd7bef8 + 39cee64 commit 569cdf0

17 files changed

+266
-0
lines changed

articles/mariadb/TOC.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@
7575
items:
7676
- name: Data-in replication
7777
href: concepts-data-in-replication.md
78+
- name: Read replicas
79+
href: concepts-read-replicas.md
7880
- name: How-to guides
7981
items:
8082
- name: Firewall rules
@@ -125,6 +127,8 @@
125127
items:
126128
- name: Configure data-in replication
127129
href: howto-data-in-replication.md
130+
- name: Create read replicas Azure portal
131+
href: howto-read-replicas-portal.md
128132
- name: Troubleshoot
129133
items:
130134
- name: Troubleshoot connection errors
Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
---
2+
title: Read replicas in Azure Database for MariaDB
3+
description: This article describes read replicas for Azure Database for MariaDB.
4+
author: ajlam
5+
ms.author: andrela
6+
ms.service: mariadb
7+
ms.topic: conceptual
8+
ms.date: 06/10/2019
9+
---
10+
11+
# Read replicas in Azure Database for MariaDB
12+
13+
The read replica feature allows you to replicate data from an Azure Database for MariaDB server to a read-only server. You can replicate from the master server to up to five replicas within the same region as the master. Replicas are updated asynchronously using the MariaDB engine's binary log (binlog) file position-based replication technology with global transaction ID (GTID). To learn more about binlog replication, see the [binlog replication overview](https://mariadb.com/kb/en/library/replication-overview/).
14+
15+
> [!IMPORTANT]
16+
> Same region read replicas is currently in public preview.
17+
18+
Replicas are new servers that you manage similar to regular Azure Database for MariaDB servers. For each read replica, you're billed for the provisioned compute in vCores and storage in GB/ month.
19+
20+
To learn more about GTID replication, please see the [MariaDB replication documentation](https://mariadb.com/kb/en/library/gtid/).
21+
22+
## When to use a read replica
23+
24+
The read replica feature helps to improve the performance and scale of read-intensive workloads. Read workloads can be isolated to the replicas, while write workloads can be directed to the master.
25+
26+
A common scenario is to have BI and analytical workloads use the read replica as the data source for reporting.
27+
28+
Because replicas are read-only, they don't directly reduce write-capacity burdens on the master. This feature isn't targeted at write-intensive workloads.
29+
30+
The read replica feature uses asynchronous replication. The feature isn't meant for synchronous replication scenarios. There will be a measurable delay between the master and the replica. The data on the replica eventually becomes consistent with the data on the master. Use this feature for workloads that can accommodate this delay.
31+
32+
Read replicas can enhance your disaster recovery plan. If there is a regional disaster and your master server is unavailable, you can direct your workload to a replica in another region. To do this, first let the replica accept writes by using the stop replication function. You can then redirect your application by updating the connection string. Learn more in the [stop replication](#stop-replication) section.
33+
34+
## Create a replica
35+
36+
If a master server has no existing replica servers, the master will first restart to prepare itself for replication.
37+
38+
When you start the create replica workflow, a blank Azure Database for MariaDB server is created. The new server is filled with the data that was on the master server. The creation time depends on the amount of data on the master and the time since the last weekly full backup. The time can range from a few minutes to several hours.
39+
40+
> [!NOTE]
41+
> If you don't have a storage alert set up on your servers, we recommend that you do so. The alert informs you when a server is approaching its storage limit, which will affect the replication.
42+
43+
Learn how to [create a read replica in the Azure portal](howto-read-replicas-portal.md).
44+
45+
## Connect to a replica
46+
47+
When you create a replica, it doesn't inherit the firewall rules or VNet service endpoint of the master server. These rules must be set up independently for the replica.
48+
49+
The replica inherits the admin account from the master server. All user accounts on the master server are replicated to the read replicas. You can only connect to a read replica by using the user accounts that are available on the master server.
50+
51+
You can connect to the replica by using its hostname and a valid user account, as you would on a regular Azure Database for MariaDB server. For a server named **myreplica** with the admin username **myadmin**, you can connect to the replica by using the mysql CLI:
52+
53+
```bash
54+
mysql -h myreplica.mariadb.database.azure.com -u myadmin@myreplica -p
55+
```
56+
57+
At the prompt, enter the password for the user account.
58+
59+
## Monitor replication
60+
61+
Azure Database for MariaDB provides the **Replication lag in seconds** metric in Azure Monitor. This metric is available for replicas only.
62+
63+
This metric is calculated using the `seconds_behind_master` metric available in MariaDB's `SHOW SLAVE STATUS` command.
64+
65+
Set an alert to inform you when the replication lag reaches a value that isn’t acceptable for your workload.
66+
67+
## Stop replication
68+
69+
You can stop replication between a master and a replica. After replication is stopped between a master server and a read replica, the replica becomes a standalone server. The data in the standalone server is the data that was available on the replica at the time the stop replication command was started. The standalone server doesn't catch up with the master server.
70+
71+
When you choose to stop replication to a replica, it loses all links to its previous master and other replicas. There is no automated failover between a master and its replica.
72+
73+
> [!IMPORTANT]
74+
> The standalone server can't be made into a replica again.
75+
> Before you stop replication on a read replica, ensure the replica has all the data that you require.
76+
77+
Learn how to [stop replication to a replica](howto-read-replicas-portal.md).
78+
79+
## Considerations and limitations
80+
81+
### Pricing tiers
82+
83+
Read replicas are currently only available in the General Purpose and Memory Optimized pricing tiers.
84+
85+
### Master server restart
86+
87+
When you create a replica for a master that has no existing replicas, the master will first restart to prepare itself for replication. Please take this into consideration and perform these operations during an off-peak period.
88+
89+
### New replicas
90+
91+
A read replica is created as a new Azure Database for MariaDB server. An existing server can't be made into a replica. You can't create a replica of another read replica.
92+
93+
### Replica configuration
94+
95+
A replica is created by using the same server configuration as the master. After a replica is created, several settings can be changed independently from the master server: compute generation, vCores, storage, backup retention period, and MariaDB engine version. The pricing tier can also be changed independently, except to or from the Basic tier.
96+
97+
> [!IMPORTANT]
98+
> Before a master server configuration is updated to new values, update the replica configuration to equal or greater values. This action ensures the replica can keep up with any changes made to the master.
99+
100+
### Stopped replicas
101+
102+
If you stop replication between a master server and a read replica, the stopped replica becomes a standalone server that accepts both reads and writes. The standalone server can't be made into a replica again.
103+
104+
### Deleted master and standalone servers
105+
106+
When a master server is deleted, replication is stopped to all read replicas. These replicas become standalone servers. The master server itself is deleted.
107+
108+
### User accounts
109+
110+
Users on the master server are replicated to the read replicas. You can only connect to a read replica using the user accounts available on the master server.
111+
112+
### Server parameters
113+
114+
To prevent data from becoming out of sync and to avoid potential data loss or corruption, some server parameters are locked from being updated when using read replicas.
115+
116+
The following server parameters are locked on both the master and replica servers:
117+
- [`innodb_file_per_table`](https://mariadb.com/kb/en/library/innodb-system-variables/#innodb_file_per_table)
118+
- [`log_bin_trust_function_creators`](https://mariadb.com/kb/en/library/replication-and-binary-log-system-variables/#log_bin_trust_function_creators)
119+
120+
The [`event_scheduler`](https://mariadb.com/kb/en/library/server-system-variables/#event_scheduler) parameter is locked on the replica servers.
121+
122+
### Other
123+
124+
- Creating a replica of a replica is not supported.
125+
- In-memory tables may cause replicas to become out of sync. This is a limitation of the MariaDB replication technology.
126+
- Ensure the master server tables have primary keys. Lack of primary keys may result in replication latency between the master and replicas.
127+
128+
## Next steps
129+
130+
- Learn how to [create and manage read replicas using the Azure portal](howto-read-replicas-portal.md)
Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
---
2+
title: Create and manage read replicas in Azure Database for MariaDB
3+
description: This article describes how to set up and manage read replicas in Azure Database for MariaDB using the portal
4+
author: ajlam
5+
ms.author: andrela
6+
ms.service: mariadb
7+
ms.topic: conceptual
8+
ms.date: 06/10/2019
9+
---
10+
11+
# How to create and manage read replicas in Azure Database for MariaDB using the Azure portal
12+
13+
In this article, you will learn how to create and manage read replicas in the Azure Database for MariaDB service using the Azure portal.
14+
15+
> [!IMPORTANT]
16+
> Same region read replicas is currently in public preview.
17+
18+
## Prerequisites
19+
20+
- An [Azure Database for MariaDB server](quickstart-create-mariadb-server-database-using-azure-portal.md) that will be used as the master server.
21+
22+
> [!IMPORTANT]
23+
> The read replica feature is only available for Azure Database for MariaDB servers in the General Purpose or Memory Optimized pricing tiers. Ensure the master server is in one of these pricing tiers.
24+
25+
## Create a read replica
26+
27+
A read replica server can be created using the following steps:
28+
29+
1. Sign into the [Azure portal](https://portal.azure.com/).
30+
31+
2. Select the existing Azure Database for MariaDB server that you want to use as a master. This action opens the **Overview** page.
32+
33+
3. Select **Replication** from the menu, under **SETTINGS**.
34+
35+
4. Select **Add Replica**.
36+
37+
![Azure Database for MariaDB - Replication](./media/howto-read-replica-portal/add-replica.png)
38+
39+
5. Enter a name for the replica server.
40+
41+
![Azure Database for MariaDB - Replica name](./media/howto-read-replica-portal/replica-name.png)
42+
43+
6. Select **OK** to confirm creation of the replica.
44+
45+
> [!NOTE]
46+
> Read replicas are created with the same server configuration as the master. The replica server configuration can be changed after it has been created. It is recommended that the replica server's configuration should be kept at equal or greater values than the master to ensure the replica is able to keep up with the master.
47+
48+
Once the replica server has been created, it can be viewed from the **Replication** blade.
49+
50+
![Azure Database for MariaDB - List replicas](./media/howto-read-replica-portal/list-replica.png)
51+
52+
## Stop replication to a replica server
53+
54+
> [!IMPORTANT]
55+
> Stopping replication to a server is irreversible. Once replication has stopped between a master and replica, it cannot be undone. The replica server then becomes a standalone server and now supports both read and writes. This server cannot be made into a replica again.
56+
57+
To stop replication between a master and a replica server from the Azure portal, use the following steps:
58+
59+
1. In the Azure portal, select your master Azure Database for MariaDB server.
60+
61+
2. Select **Replication** from the menu, under **SETTINGS**.
62+
63+
3. Select the replica server you wish to stop replication for.
64+
65+
![Azure Database for MariaDB - Stop replication select server](./media/howto-read-replica-portal/stop-replication-select.png)
66+
67+
4. Select **Stop replication**.
68+
69+
![Azure Database for MariaDB - Stop replication](./media/howto-read-replica-portal/stop-replication.png)
70+
71+
5. Confirm you want to stop replication by clicking **OK**.
72+
73+
![Azure Database for MariaDB - Stop replication confirm](./media/howto-read-replica-portal/stop-replication-confirm.png)
74+
75+
## Delete a replica server
76+
77+
To delete a read replica server from the Azure portal, use the following steps:
78+
79+
1. In the Azure portal, select your master Azure Database for MariaDB server.
80+
81+
2. Select **Replication** from the menu, under **SETTINGS**.
82+
83+
3. Select the replica server you wish to delete.
84+
85+
![Azure Database for MariaDB - Delete replica select server](./media/howto-read-replica-portal/delete-replica-select.png)
86+
87+
4. Select **Delete replica**
88+
89+
![Azure Database for MariaDB - Delete replica](./media/howto-read-replica-portal/delete-replica.png)
90+
91+
5. Type the name of the replica and click **Delete** to confirm deletion of the replica.
92+
93+
![Azure Database for MariaDB - Delete replica confirm](./media/howto-read-replica-portal/delete-replica-confirm.png)
94+
95+
## Delete a master server
96+
97+
> [!IMPORTANT]
98+
> Deleting a master server stops replication to all replica servers and deletes the master server itself. Replica servers become standalone servers that now support both read and writes.
99+
100+
To delete a master server from the Azure portal, use the following steps:
101+
102+
1. In the Azure portal, select your master Azure Database for MariaDB server.
103+
104+
2. From the **Overview**, select **Delete**.
105+
106+
![Azure Database for MariaDB - Delete master](./media/howto-read-replica-portal/delete-master-overview.png)
107+
108+
3. Type the name of the master server and click **Delete** to confirm deletion of the master server.
109+
110+
![Azure Database for MariaDB - Delete master](./media/howto-read-replica-portal/delete-master-confirm.png)
111+
112+
## Monitor replication
113+
114+
1. In the [Azure portal](https://portal.azure.com/), select the replica Azure Database for MariaDB server you want to monitor.
115+
116+
2. Under the **Monitoring** section of the sidebar, select **Metrics**:
117+
118+
3. Select **Replication lag in seconds** from the dropdown list of available metrics.
119+
120+
![Select Replication lag](./media/howto-read-replica-portal/monitor-select-replication-lag.png)
121+
122+
4. Select the time range you wish to view. The image below selects a 30 minute time range.
123+
124+
![Select time range](./media/howto-read-replica-portal/monitor-replication-lag-time-range.png)
125+
126+
5. View the replication lag for the selected time range. The image below displays the last 30 minutes for a large workload.
127+
128+
![Select time range](./media/howto-read-replica-portal/monitor-replication-lag-time-range-thirty-mins.png)
129+
130+
## Next steps
131+
132+
- Learn more about [read replicas](concepts-read-replicas.md)
70.3 KB
Loading
125 KB
Loading
114 KB
Loading
49.8 KB
Loading
76.5 KB
Loading
76.7 KB
Loading
76.4 KB
Loading

0 commit comments

Comments
 (0)