如何使用 Azure 门户在 Azure Database for MariaDB 中创建和管理只读副本How to create and manage read replicas in Azure Database for MariaDB using the Azure portal

本文介绍如何使用 Azure 门户在 Azure Database for MariaDB 服务中创建和管理只读副本。In this article, you will learn how to create and manage read replicas in the Azure Database for MariaDB service using the Azure portal.

先决条件Prerequisites

Important

只读副本功能仅适用于“常规用途”或“内存优化”定价层中的 Azure Database for MariaDB 服务器。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.

创建只读副本Create a read replica

可以使用以下步骤创建只读副本服务器:A read replica server can be created using the following steps:

  1. 登录到 Azure 门户Sign into the Azure portal.

  2. 选择要用作主服务器的现有 Azure Database for MariaDB 服务器。Select the existing Azure Database for MariaDB server that you want to use as a master. 此操作将打开“概述” 页。This action opens the Overview page.

  3. 从菜单中的“设置” 下,选择“复制” 。Select Replication from the menu, under SETTINGS.

  4. 选择“添加副本” 。Select Add Replica.

    Azure Database for MariaDB - 复制

  5. 输入副本服务器的名称。Enter a name for the replica server.

    Azure Database for MariaDB - 副本名称

  6. 选择副本服务器的位置。Select the location for the replica server. 默认位置与主服务器的位置相同。The default location is the same as the master server's.

    Azure Database for MariaDB - 副本位置

    Note

    跨区域复制处于预览状态。Cross region replication is in preview. 若要详细了解可以在哪些区域中创建副本,请访问只读副本概念文章To learn more about which regions you can create a replica in, visit the read replica concepts article.

  7. 选择“确定”以确认创建该副本。 Select OK to confirm creation of the replica.

Note

只读副本使用与主服务器相同的服务器配置创建。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.

一旦创建副本服务器,可以从“复制” 边栏选项卡中进行查看。Once the replica server has been created, it can be viewed from the Replication blade.

Azure Database for MariaDB - 列出副本

停止复制到副本服务器Stop replication to a replica server

Important

停止复制到服务器操作不可逆。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.

若要从 Azure 门户停止主服务器和副本服务器之间的复制,请使用以下步骤:To stop replication between a master and a replica server from the Azure portal, use the following steps:

  1. 在 Azure 门户中,选择主 Azure Database for MariaDB 服务器。In the Azure portal, select your master Azure Database for MariaDB server.

  2. 从菜单中的“设置” 下,选择“复制” 。Select Replication from the menu, under SETTINGS.

  3. 选择要停止复制的副本服务器。Select the replica server you wish to stop replication for.

    Azure Database for MariaDB - 停止复制选择服务器

  4. 选择“停止复制” 。Select Stop replication.

    Azure Database for MariaDB - 停止复制

  5. 通过单击“确定” ,确认要停止复制。Confirm you want to stop replication by clicking OK.

    Azure Database for MariaDB - 停止复制确认

删除副本服务器Delete a replica server

若要从 Azure 门户删除只读副本服务器,请使用以下步骤:To delete a read replica server from the Azure portal, use the following steps:

  1. 在 Azure 门户中,选择主 Azure Database for MariaDB 服务器。In the Azure portal, select your master Azure Database for MariaDB server.

  2. 从菜单中的“设置” 下,选择“复制” 。Select Replication from the menu, under SETTINGS.

  3. 选择要删除的副本服务器。Select the replica server you wish to delete.

    Azure Database for MariaDB - 删除副本选择服务器

  4. 选择“删除副本” Select Delete replica

    Azure Database for MariaDB - 删除副本

  5. 键入副本的名称,然后单击“删除” 以确认删除副本。Type the name of the replica and click Delete to confirm deletion of the replica.

    Azure Database for MariaDB - 删除副本确认

删除主服务器Delete a master server

Important

删除主服务器会停止复制到所有副本服务器,并删除主服务器本身。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.

若要从 Azure 门户删除主服务器,请使用以下步骤:To delete a master server from the Azure portal, use the following steps:

  1. 在 Azure 门户中,选择主 Azure Database for MariaDB 服务器。In the Azure portal, select your master Azure Database for MariaDB server.

  2. 从“概览” 中,选择“删除” 。From the Overview, select Delete.

    Azure Database for MariaDB - 删除主服务器

  3. 键入主服务器的名称,然后单击“删除” 以确认删除主服务器。Type the name of the master server and click Delete to confirm deletion of the master server.

    Azure Database for MariaDB - 删除主服务器

监视复制Monitor replication

  1. Azure 门户中,选择要监视的副本 Azure Database for MariaDB 服务器。In the Azure portal, select the replica Azure Database for MariaDB server you want to monitor.

  2. 在边栏的“监视” 部分,选择“指标” :Under the Monitoring section of the sidebar, select Metrics:

  3. 从可用指标的下拉列表中选择“复制延迟(秒)” 。Select Replication lag in seconds from the dropdown list of available metrics.

    选择复制延迟时间

  4. 选择要查看的时间范围。Select the time range you wish to view. 下图选择 30 分钟的时间范围。The image below selects a 30 minute time range.

    选择时间范围

  5. 查看所选时间范围的复制延迟时间。View the replication lag for the selected time range. 下图显示了大型工作负荷的过去 30 分钟。The image below displays the last 30 minutes for a large workload.

    选择时间范围

后续步骤Next steps