将数据复制到 Azure Database for MariaDBReplicate data into Azure Database for MariaDB

通过数据传入复制,可将数据从本地运行的 MariaDB 服务器、虚拟机中或其他云提供程序托管的数据库服务中同步到 Azure Database for MariaDB 服务。Data-in Replication allows you to synchronize data from a MariaDB server running on-premises, in virtual machines, or database services hosted by other cloud providers into the Azure Database for MariaDB service. 数据传入复制功能依靠的是基于二进制日志 (binlog) 文件位置、从本机到 MariaDB 的复制。Data-in Replication is based on the binary log (binlog) file position-based replication native to MariaDB. 要详细了解 binlog 复制,请参阅 binlog 复制概述To learn more about binlog replication, see the binlog replication overview.

何时使用配置复制中数据When to use Data-in Replication

可以考虑使用复制中数据的主要场景有:The main scenarios to consider using Data-in Replication are:

  • 混合数据同步: 借助数据传入复制,可以在本地服务器和 Azure Database for MariaDB 之间同步数据。Hybrid Data Synchronization: With Data-in Replication, you can keep data synchronized between your on-premises servers and Azure Database for MariaDB. 此同步可用于创建混合应用程序。This synchronization is useful for creating hybrid applications. 如果有现有的本地数据库服务器,但想要将数据移到更靠近最终用户的区域,那么此方法很有吸引力。This method is appealing when you have an existing local database server, but want to move the data to a region closer to end users.
  • 多云同步: 对于复杂的云解决方案,使用数据传入复制在 Azure Database for MariaDB 和不同的云服务提供商之间同步数据,包括虚拟机和托管在这些云中的数据库服务。Multi-Cloud Synchronization: For complex cloud solutions, use Data-in Replication to synchronize data between Azure Database for MariaDB and different cloud providers, including virtual machines and database services hosted in those clouds.

限制和注意事项Limitations and considerations

不会复制的数据Data not replicated

不会复制主服务器上的 mysql 系统数据库The mysql system database on the master server is not replicated. 不会复制对主服务器上的帐户和权限所做的更改。Changes to accounts and permissions on the master server are not replicated. 如果在主服务器上创建帐户,并且此帐户需要访问副本服务器,则在副本服务器上手动创建相同的帐户。If you create an account on the master server and this account needs to access the replica server, then manually create the same account on the replica server side. 要了解系统数据库中包含哪些表,请参阅 MariaDB 文档To understand what tables are contained in the system database, see the MariaDB documentation.

要求Requirements

  • 主服务器版本不得低于 MariaDB 10.2 版本。The master server version must be at least MariaDB version 10.2.
  • 主服务器版本和副本服务器版本必须相同。The master and replica server versions must be the same. 例如,两者都必须是 MariaDB 10.2 版本。For example, both must be MariaDB version 10.2.
  • 每个表都必须有主键。Each table must have a primary key.
  • 主服务器应使用 InnoDB 引擎。Master server should use the InnoDB engine.
  • 用户必须具有权限才能在主服务器上配置二进制日志记录和创建新用户。User must have permissions to configure binary logging and create new users on the master server.
  • 如果主服务器启用了 SSL,请确保为域提供的 SSL CA 证书已包含在 mariadb.az_replication_change_master 存储过程中。If the master server has SSL enabled, ensure the SSL CA certificate provided for the domain has been included in the mariadb.az_replication_change_master stored procedure. 请参阅以下示例master_ssl_ca 参数。Refer to the following examples and the master_ssl_ca parameter.
  • 确保主服务器的 IP 地址已添加到 Azure Database for MariaDB 副本服务器的防火墙规则中。Ensure the master server's IP address has been added to the Azure Database for MariaDB replica server's firewall rules. 使用 Azure 门户Azure CLI 更新防火墙规则。Update firewall rules using the Azure portal or Azure CLI.
  • 确保托管主服务器的计算机在端口 3306 上允许入站和出站流量。Ensure the machine hosting the master server allows both inbound and outbound traffic on port 3306.
  • 请确保主服务器具有公共 IP 地址,DNS 可公开访问,或具有完全限定的域名 (FQDN)。Ensure the the master server has a public IP address, the DNS is publicly accessible, or has a fully qualified domain name (FQDN).

其他Other

  • 仅可在常规用途和优化内存定价层中使用数据传入复制功能。Data-in replication is only supported in General Purpose and Memory Optimized pricing tiers.

后续步骤Next steps