在 Azure 中选择适当的 MySQL Server 选项Choose the right MySQL Server option in Azure


将要查看的是 Azure Database for MySQL 的新服务。You are viewing the new service of Azure Database for MySQL. 若要查看经典 MySQL Database for Azure 的文档,请访问此页To view the documentation for classic MySQL Database for Azure, please visit this page.

在 Azure 中,MySQL 服务器工作负荷可以在托管的虚拟机基础结构即服务 (IaaS) 中运行,或者作为托管的平台即服务 (PaaS) 运行。With Azure, your MySQL server workloads can run in a hosted virtual machine infrastructure as a service (IaaS) or as a hosted platform as a service (PaaS). 在 IaaS 和 PaaS 之间选择时,必须决定是要管理数据库、应用修补程序并进行备份,还是要将这些操作委托给 Azure。When you choose between IaaS and PaaS, you must decide if you want to manage your database, apply patches, and make backups, or if you want to delegate these operations to Azure.

做出决策时,请考虑以下选项:When making your decision, consider the following two options:

  • Azure Database for MySQLAzure Database for MySQL. 此选项是基于稳定 MySQL 社区版的完全托管式 MySQL 数据库引擎。This option is a fully managed MySQL database engine based on the stable version of MySQL community edition. 此关系数据库即服务 (DBaaS) 托管在 Azure 云平台中,属于 PaaS 行业类别。This relational database as a service (DBaaS), hosted on the Azure cloud platform, falls into the industry category of PaaS.

    借助 Azure 上 MySQL 的托管实例,可使用自动修补、高可用性、自动备份、弹性缩放、企业级安全性、合规性和治理、监视和警报等内置功能。否则,当 MySQL 服务器位于本地或 Azure VM 中时,这些内置功能需要进行大量配置。With a managed instance of MySQL on Azure, you can use built-in features viz automated patching, high availability, automated backups, elastic scaling, enterprise grade security, compliance and governance, monitoring and alerting that otherwise require extensive configuration when MySQL Server is either on-premises or in an Azure VM. 将 MySQL 用作服务时,需要预先支付纵向或横向扩展选项的费用才能在不中断服务的情况下获得更高的控制度。When using MySQL as a service, you pay-in-advance, with options to scale up or scale out for greater control with no interruption.

    • 单一服务器是一项完全托管的数据库服务,对数据库自定义的要求最低。Single Server is a fully managed database service with minimal requirements for customizations of the database. 单一服务器平台旨在以最少的用户配置和控制来处理大多数数据库管理功能,例如修补、备份、高可用性、安全性。The single server platform is designed to handle most of the database management functions such as patching, backups, high availability, security with minimal user configuration and control. 此体系结构经过优化,可在单个区域提供 99.99% 的可用性。The architecture is optimized to provide 99.99% availability on single region. 单一服务器最适合用于云原生应用程序,这些应用程序旨在处理自动修补,而无需对修补计划和自定义 MySQL 配置设置进行精细控制。Single servers are best suited for cloud native applications designed to handle automated patching without the need for granular control on the patching schedule and custom MySQL configuration settings.
  • Azure VM 上的 MySQLMySQL on Azure VMs. 此选项属于 IaaS 行业类别。This option falls into the industry category of IaaS. 使用此服务可以在 Azure 云平台上的托管虚拟机中运行 MySQL 服务器。With this service, you can run MySQL Server inside a managed virtual machine on the Azure cloud platform. 所有最新版本的 MySQL 都可以安装在该虚拟机中。All recent versions and editions of MySQL can be installed in the virtual machine.

比较 Azure 中的 MySQL 部署选项Comparing the MySQL deployment options in Azure

下表列出了这些选项之间的主要差别:The main differences between these options are listed in the following table:

属性Attribute Azure Database for MySQLAzure Database for MySQL
单台服务器Single Server
Azure VM 上的 MySQLMySQL on Azure VMs
MySQL 版本支持MySQL Version Support 5.6、5.7 和 8.05.6, 5.7 & 8.0 任何版本Any version
计算缩放Compute scaling 支持(不支持从基本层缩放和缩放到基本层)Supported (Scaling from and to Basic tier is not supported) 支持Supported
存储大小Storage size 5 GiB 到 16 TiB5 GiB to 16 TiB 32 GiB 到 32,767 GiB32 GiB to 32,767 GiB
联机存储缩放Online Storage scaling 支持Supported 不支持Not supported
自动存储缩放Auto storage scaling 支持Supported 不支持Not supported
网络连接Network Connectivity - 具有服务器防火墙的公共终结点。- Public endpoints with server firewall.
- 具有专用链接支持的专用访问。- Private access with Private Link support.
- 具有服务器防火墙的公共终结点。- Public endpoints with server firewall.
- 具有专用链接支持的专用访问。- Private access with Private Link support.
服务级别协议 (SLA)Service-level agreement (SLA) 99.99% 可用性 SLA99.99% availability SLA 99.99% 使用可用性区域99.99% using Availability Zones
操作系统修补Operating system patching 自动Automatic 由最终用户管理Managed by end users
MySQL 修补MySQL patching 自动Automatic 由最终用户管理Managed by end users
高可用性High availability 单个区域内的内置 HABuilt-in HA within single region 使用群集、复制等进行自定义托管Custom managed using clustering, replication etc
混合场景Hybrid scenarios 支持,并可使用数据传入复制Supported with Data-in Replication 由最终用户管理Managed by end users
只读副本Read replicas 受支持(最多 5 个副本)Supported (up to 5 replicas) 由最终用户管理Managed by end users
BackupBackup 自动执行,保留 7-35 天Automated with 7-35 days retention 由最终用户管理Managed by end users
监视数据库操作Monitoring database operations 支持Supported 由最终用户管理Managed by end users
灾难恢复Disaster recovery 支持,可以使用异地冗余备份存储和跨区域只读副本Supported with geo-redundant backup storage and cross region read replicas 使用复制技术进行自定义托管Custom Managed with replication technologies
查询性能见解Query Performance Insights 支持Supported 由最终用户管理Managed by end users
Azure AD 身份验证Azure AD Authentication 支持Supported 不支持Not Supported
SSL/TLSSSL/TLS 默认情况下已启用,支持 TLS v1.2、1.1 和 1.0Enabled by default with support for TLS v1.2, 1.1 and 1.0 在 TLS v1.2、1.1 和 1.0 中受支持Supported with TLS v1.2, 1.1 and 1.0
群队管理Fleet Management 在 Azure CLI、PowerShell、REST 和 Azure 资源管理器中受支持Supported with Azure CLI, PowerShell, REST, and Azure Resource Manager 装有 Azure CLI、PowerShell、REST 和 Azure 资源管理器的 VM 支持此功能Supported for VMs with Azure CLI, PowerShell, REST, and Azure Resource Manager

选择 PaaS 或 IaaS 的业务动机Business motivations for choosing PaaS or IaaS

有多个因素可能会影响你决定选择 PaaS 或 IaaS 来托管 MySQL 数据库。There are several factors that can influence your decision to choose PaaS or IaaS to host your MySQL databases.


成本缩减通常是确定用于托管数据库的最佳解决方案的主要考虑因素。Cost reduction is often the primary consideration that determines the best solution for hosting your databases. 无论你是现金不足的创业公司,或是在预算严格受限的情况下运作现有公司的团队,都存在这种情况。This is true whether you're a startup with little cash or a team in an established company that operates under tight budget constraints. 本部分介绍 Azure 中适用于 Azure Database for MySQL 和 Azure VM 上的 MySQL 的计费与许可基础知识。This section describes billing and licensing basics in Azure as they apply to Azure Database for MySQL and MySQL on Azure VMs.


Azure Database for MySQL 目前在多个层级中以服务的形式提供,它资源价格各不相同。Azure Database for MySQL is currently available as a service in several tiers with different prices for resources. 所有资源都按固定费率按小时计费。All resources are billed hourly at a fixed rate. 有关目前支持的服务层级、计算大小和存储量的最新信息,请参阅定价页For the latest information on the currently supported service tiers, compute sizes, and storage amounts, see pricing page. 可以动态调整服务层级和计算大小,以满足应用程序的不同吞吐量需求。You can dynamically adjust service tiers and compute sizes to match your application's varied throughput needs. 你需要按一般的数据传输费率支付 Internet 流量传出费用。You're billed for outgoing Internet traffic at regular data transfer rates.

Azure 使用 Azure Database for MySQL 自动配置、修补和升级数据库软件。With Azure Database for MySQL, Azure automatically configures, patches, and upgrades the database software. 这些自动化操作可以降低管理成本。These automated actions reduce your administration costs. 此外,Azure Database for MySQL 提供自动备份功能。Also, Azure Database for MySQL has automated backups capabilities. 这些功能可帮助你大幅节省成本,尤其是存在大量的数据库时。These capabilities help you achieve significant cost savings, especially when you have a large number of databases. 相比之下,对于 Azure VM 上的 MySQL,可以选择并运行任何 MySQL 版本。In contrast, with MySQL on Azure VMs you can choose and run any MySQL version. 无论你使用哪个 MySQL 版本,你都要为预配的 VM、与数据关联的存储成本、备份、数据和日志存储监视以及所使用的特定 MySQL 许可证类型(如果有)的成本付费。No matter what MySQL version you use, you pay for the provisioned VM, storage cost associated with the data, backup, monitoring data and log storage and the costs for the specific MySQL license type used (if any).

Azure Database for MySQL 针对任何类型的节点级中断提供内置高可用性,同时仍可为服务维护 99.99% 的 SLA 保证。Azure Database for MySQL provides built-in high availability for any kind of node-level interruption while still maintaining the 99.99% SLA guarantee for the service. 但是,若要在 VM 中实现数据库高可用性,请使用 MySQL 数据库上提供的高可用性选项,例如 MySQL 复制However, for database high availability within VMs, you use the high availability options like MySQL replication that are available on a MySQL database. 使用支持的高可用性选项不会提供额外的 SLA。Using a supported high availability option doesn't provide an additional SLA. 但是,它可以让你凭借额外的成本和管理开销实现 99.99% 以上的数据库可用性。But it does let you achieve greater than 99.99% database availability at additional cost and administrative overhead.

有关定价的详细信息,请参阅以下文章:For more information on pricing, see the following articles:


对许多企业来说,决定过渡到到云服务的关键在于降低管理复杂度,因为这涉及到成本。For many businesses, the decision to transition to a cloud service is as much about offloading complexity of administration as it is about cost.

使用 IaaS 时,Azure:With IaaS, Azure:

  • 管理底层基础结构。Administers the underlying infrastructure.
  • 为基础硬件和 OS 提供自动修补。Provides automated patching for underlying hardware and OS.

使用 PaaS 时,Azure:With PaaS, Azure:

  • 管理底层基础结构。Administers the underlying infrastructure.
  • 为基础硬件、OS 和数据库引擎提供自动修补。Provides automated patching for underlying hardware, OS, and database engine.
  • 管理数据库的高可用性。Manages high availability of the database.
  • 自动执行备份并复制所有数据以提供灾难恢复。Automatically performs backups and replicates all data to provide disaster recovery.
  • 默认加密静态数据和动态数据。Encrypts the data at rest and in motion by default.
  • 监视服务器并提供针对查询性能见解和性能建议的功能Monitors your server and provides features for query performance insights and performance recommendations

以下列表描述了每个选项的管理注意事项:The following list describes administrative considerations for each option:

  • 使用 Azure Database for MySQL 可以持续管理数据库。With Azure Database for MySQL, you can continue to administer your database. 但是,不再需要管理数据库引擎、操作系统或硬件。But you no longer need to manage the database engine, the operating system, or the hardware. 可以持续管理的项的示例包括:Examples of items you can continue to administer include:

    • 数据库Databases
    • 登录Sign-in
    • 索引优化Index tuning
    • 查询优化Query tuning
    • 审核Auditing
    • 安全性Security

    此外,在另一个数据中心配置高可用性只需极少量的配置或管理,或者根本无需配置或管理。Additionally, configuring high availability to another data center requires minimal to no configuration or administration.

  • 使用 Azure VM 上的 MySQL,可以完全掌控操作系统和 MySQL 服务器实例配置。With MySQL on Azure VMs, you have full control over the operating system and the MySQL server instance configuration. 使用 VM,可以决定何时更新或升级操作系统和数据库软件,以及应用哪些补丁。With a VM, you decide when to update or upgrade the operating system and database software and what patches to apply. 还可以决定何时安装任何其他软件,例如防病毒应用程序。You also decide when to install any additional software such as an antivirus application. 提供的某些自动化功能可以大大简化修补、备份和高可用性。Some automated features are provided to greatly simplify patching, backup, and high availability. 可以控制 VM 的大小、磁盘数目及其存储配置。You can control the size of the VM, the number of disks, and their storage configurations. 有关详细信息,请参阅 Azure 的虚拟机和云服务大小For more information, see Virtual machine and cloud service sizes for Azure.

迁移到 Azure 的时机Time to move to Azure

  • 当开发人员工作效率和新解决方案的快速面市时间至关重要时,Azure Database for MySQL 是面向云的应用程序的适当解决方案。Azure Database for MySQL is the right solution for cloud-designed applications when developer productivity and fast time to market for new solutions are critical. 该服务提供类似于 DBA 的编程功能,非常适合云架构师和开发人员,因为它能降低管理底层操作系统和数据库的需求。With programmatic functionality that is like DBA, the service is suitable for cloud architects and developers because it lowers the need for managing the underlying operating system and database.

  • 如果你不想花费时间和金钱获取新的本地硬件,则可使用 Azure VM 上的 MySQL,它是满足以下条件的应用程序的理想解决方案:需要对服务不支持的 MySQL 引擎进行精细控制和自定义,或者需要访问基础 OS。When you want to avoid the time and expense of acquiring new on-premises hardware, MySQL on Azure VMs is the right solution for applications that require a granular control and customization of MySQL engine not supported by the service or requiring access of the underlying OS. 如果 Azure Database for MySQL 不合适,则此解决方案也很适合将现有的本地应用程序和数据库按原样迁移到 Azure。This solution is also suitable for migrating existing on-premises applications and databases to Azure intact, for cases where Azure Database for MySQL is a poor fit.

由于无需更改呈现层、应用层和数据层,重新架构现有解决方案时可以节省时间和预算。Because there's no need to change the presentation, application, and data layers, you save time and budget on rearchitecting your existing solution. 你可以专注于将所有解决方案迁移到 Azure,并执行 Azure 平台可能需要的某些性能优化。Instead, you can focus on migrating all your solutions to Azure and addressing some performance optimizations that the Azure platform might require.

后续步骤Next steps