您现在访问的是微软AZURE全球版技术文档网站,若需要访问由世纪互联运营的MICROSOFT AZURE中国区技术文档网站,请访问 https://docs.azure.cn.

将现有 Azure 服务总线标准命名空间迁移到高级层Migrate existing Azure Service Bus standard namespaces to the premium tier

以前,Azure 服务总线仅在标准层上提供命名空间。Previously, Azure Service Bus offered namespaces only on the standard tier. 命名空间是针对低吞吐量和开发人员环境进行了优化的多租户设置。Namespaces are multi-tenant setups that are optimized for low throughput and developer environments. 高级层以固定的价格为每个命名空间提供专用资源,使延迟可预测,并提高了吞吐量。The premium tier offers dedicated resources per namespace for predictable latency and increased throughput at a fixed price. 高级层针对高吞吐量以及需要其他企业功能的生产环境进行了优化。The premium tier is optimized for high throughput and production environments that require additional enterprise features.

本文介绍了如何将现有的标准层命名空间迁移到高级层。This article describes how to migrate existing standard tier namespaces to the premium tier.

警告

迁移适用于要升级到高级层的服务总线标准命名空间。Migration is intended for Service Bus standard namespaces to be upgraded to the premium tier. 迁移工具不支持降级。The migration tool does not support downgrading.

需要注意的一些要点:Some of the points to note:

  • 此迁移将就地进行,这意味着,现有的发送方和接收方应用程序 不需要对代码或配置进行任何更改This migration is meant to happen in place, meaning that existing sender and receiver applications don't require any changes to code or configuration. 现有的连接字符串将自动指向新的高级命名空间。The existing connection string will automatically point to the new premium namespace.
  • 要使迁移成功,高级 命名空间 不能包含任何实体The premium namespace should have no entities in it for the migration to succeed.
  • 在迁移过程中,标准命名空间中的所有 实体 都将 复制 到高级命名空间。All entities in the standard namespace are copied to the premium namespace during the migration process.
  • 在高级层上,迁移支持 每个消息传送单元包含 1,000 个实体Migration supports 1,000 entities per messaging unit on the premium tier. 若要确定你需要多少个消息传送单元,请从当前标准命名空间上的实体数开始。To identify how many messaging units you need, start with the number of entities that you have on your current standard namespace.
  • 不能直接从 基本层 迁移到 高级层,但可以间接地实现这种迁移:先从基本层迁移到标准层,然后从标准层迁移到高级层。You can't directly migrate from basic tier to premium tier, but you can do so indirectly by migrating from basic to standard first and then from the standard to premium in the next step.

迁移步骤Migration steps

迁移过程有一些相关条件。Some conditions are associated with the migration process. 请熟悉以下步骤以降低出错的可能性。Familiarize yourself with the following steps to reduce the possibility of errors. 这些步骤概述了迁移过程,后面的部分将详细列出每个步骤。These steps outline the migration process, and the step-by-step details are listed in the sections that follow.

  1. 创建新的高级命名空间。Create a new premium namespace.
  2. 将标准和高级命名空间相互配对。Pair the standard and premium namespaces to each other.
  3. 将标准命名空间中的实体同步(复制)到高级命名空间。Sync (copy-over) entities from the standard to the premium namespace.
  4. 提交迁移。Commit the migration.
  5. 使用命名空间在迁移后的名称清空标准命名空间中的实体。Drain entities in the standard namespace by using the post-migration name of the namespace.
  6. 删除标准命名空间。Delete the standard namespace.

重要

提交迁移后,访问旧的标准命名空间并清空队列和订阅。After the migration has been committed, access the old standard namespace and drain the queues and subscriptions. 清空消息后,可将其发送到新的高级命名空间,供接收方应用程序进行处理。After the messages have been drained, they may be sent to the new premium namespace to be processed by the receiver applications. 清空队列和订阅后,我们建议删除旧的标准命名空间。After the queues and subscriptions have been drained, we recommend that you delete the old standard namespace.

使用 Azure CLI 或 PowerShell 进行迁移Migrate by using the Azure CLI or PowerShell

若要使用 Azure CLI 或 PowerShell 工具将服务总线标准命名空间迁移到高级命名空间,请执行以下步骤。To migrate your Service Bus standard namespace to premium by using the Azure CLI or PowerShell tool, follow these steps.

  1. 创建新的服务总线高级命名空间。Create a new Service Bus premium namespace. 可以引用 Azure 资源管理器模板使用 Azure 门户You can reference the Azure Resource Manager templates or use the Azure portal. 对于 serviceBusSku 参数,请确保选择 premiumBe sure to select premium for the serviceBusSku parameter.

  2. 设置以下环境变量以简化迁移命令。Set the following environment variables to simplify the migration commands.

    resourceGroup = <resource group for the standard namespace>
    standardNamespace = <standard namespace to migrate>
    premiumNamespaceArmId = <Azure Resource Manager ID of the premium namespace to migrate to>
    postMigrationDnsName = <post migration DNS name entry to access the standard namespace>
    

    重要

    迁移后,将使用迁移后的别名/名称 (post_migration_dns_name) 来访问旧的标准命名空间。The Post-migration alias/name (post_migration_dns_name) will be used to access the old standard namespace post migration. 使用此别名/名称清空队列和订阅,然后删除命名空间。Use this to drain the queues and the subscriptions, and then delete the namespace.

  3. 将标准和高级命名空间配对,并使用以下命令开始同步:Pair the standard and premium namespaces and start the sync by using the following command:

    az servicebus migration start --resource-group $resourceGroup --name $standardNamespace --target-namespace $premiumNamespaceArmId --post-migration-name $postMigrationDnsName
    
  4. 使用以下命令检查迁移状态:Check the status of the migration by using the following command:

    az servicebus migration show --resource-group $resourceGroup --name $standardNamespace
    

    如果看到以下值,则认为迁移已完成:The migration is considered complete when you see the following values:

    • MigrationState = "Active"MigrationState = "Active"
    • pendingReplicationsOperationsCount = 0pendingReplicationsOperationsCount = 0
    • provisioningState = "Succeeded"provisioningState = "Succeeded"

    此命令还会显示迁移配置。This command also displays the migration configuration. 检查并确保正确设置了值。Check to ensure the values are set correctly. 另外,请在门户中检查高级命名空间,确保已创建所有队列和主题,并且这些队列和主题与标准命名空间中的内容匹配。Also check the premium namespace in the portal to ensure all the queues and topics have been created, and that they match what existed in the standard namespace.

  5. 执行以下 complete 命令提交迁移:Commit the migration by executing the following complete command:

    az servicebus migration complete --resource-group $resourceGroup --name $standardNamespace
    

使用 Azure 门户进行迁移Migrate by using the Azure portal

使用 Azure 门户进行迁移时的逻辑流与使用命令进行迁移时相同。Migration by using the Azure portal has the same logical flow as migrating by using the commands. 执行以下步骤以使用 Azure 门户进行迁移。Follow these steps to migrate by using the Azure portal.

  1. 在左侧窗格中的“导航”菜单中,选择“迁移到高级层”。 On the Navigation menu in the left pane, select Migrate to premium. 单击“开始”按钮转到下一页。 Click the Get Started button to continue to the next page. 迁移登陆页Migration Landing Page

  2. 完成“设置”。 Complete Setup. 设置命名空间Setup namespace

    1. 创建并分配要将现有标准命名空间迁移到的高级命名空间。Create and assign the premium namespace to migrate the existing standard namespace to. 设置命名空间 - 创建高级命名空间Setup namespace - create premium namespace
    2. 选择“迁移后名称”。 Choose a Post Migration name. 迁移完成后,你将使用此名称来访问标准命名空间。You'll use this name to access the standard namespace after the migration is complete. ![设置命名空间 - 选择迁移后的名称][]Setup namespace - pick post migration name
    3. 选择“下一步”继续操作。 Select 'Next' to continue.
  3. 在标准和高级命名空间之间同步实体。Sync entities between the standard and premium namespaces. 设置命名空间 - 同步实体 - 开始Setup namespace - sync entities - start

    1. 选择“开始同步”以开始同步实体。 Select Start Sync to begin syncing the entities.
    2. 在对话框中选择“是”,以确认并开始同步。 Select Yes in the dialog box to confirm and start the sync.
    3. 等待同步完成。Wait until the sync is complete. 状态栏上会显示状态。The status is available on the status bar. 设置命名空间 - 同步实体 - 进度Setup namespace - sync entities - progress

      重要

      如果出于任何原因需要中止迁移,请查看本文档的“常见问题解答”部分中的中止流。If you need to abort the migration for any reason, please review the abort flow in the FAQ section of this document.

    4. 完成同步后,选择页面底部的“下一步”。 After the sync is complete, select Next at the bottom of the page.
  4. 在摘要页上查看更改。Review changes on the summary page. 选择“完成迁移”以切换命名空间并完成迁移。 Select Complete Migration to switch namespaces and to complete the migration. 切换命名空间 - 切换菜单Switch namespace - switch menu
    迁移完成后,会显示确认页。The confirmation page appears when the migration is complete. 切换命名空间 - 成功Switch namespace - success

注意事项Caveats

Azure 服务总线高级层不支持 Azure 服务总线标准层提供的某些功能。Some of the features provided by Azure Service Bus Standard tier are not supported by Azure Service Bus Premium tier. 这是设计使然,因为高级层提供专用资源来使吞吐量和延迟可预测。These are by design since the premium tier offers dedicated resources for predictable throughput and latency.

下面是高级层不支持的功能的列表以及相应的缓解措施 -Here is a list of features not supported by Premium and their mitigation -

快速实体Express entities

高级层不支持不向存储提交任何消息数据的快速实体。Express entities that don't commit any message data to storage are not supported in Premium. 专用资源可以显著提高吞吐量,同时确保数据持久保存,这符合任何企业消息传送系统的预期。Dedicated resources provided significant throughput improvement while ensuring that data is persisted, as is expected from any enterprise messaging system.

在迁移过程中,将在高级命名空间中以非快速实体的形式创建标准命名空间中的任何快速实体。During migration, any of your express entities in your Standard namespace will be created on the Premium namespace as a non-express entity.

如果你利用 Azure 资源管理器 (ARM) 模板,请确保从部署配置中删除“enableExpress”标志,使自动化工作流能够正常执行而不出错。If you utilize Azure Resource Manager (ARM) templates, please ensure that you remove the 'enableExpress' flag from the deployment configuration so that your automated workflows execute without errors.

分区实体Partitioned entities

标准层支持分区实体,以便在多租户设置中提供更高的可用性。Partitioned entities were supported in the Standard tier to provide better availability in a multi-tenant setup. 在高级层中不再需要此功能,因为其中的每个命名空间都预配了专用资源。With the provision of dedicated resources available per namespace in the Premium tier, this is no longer needed.

在迁移过程中,将在高级命名空间中以非分区实体的形式创建标准命名空间中的任何分区实体。During migration, any partitioned entity in the Standard namespace is created on the Premium namespace as a non-partitioned entity.

如果 ARM 模板将特定队列或主题的“enablePartitioning”设置为“true”,则代理将忽略此队列或主题。If your ARM template sets 'enablePartitioning' to 'true' for a specific Queue or Topic, then it will be ignored by the broker.

常见问题FAQs

提交迁移后会发生什么情况?What happens when the migration is committed?

提交迁移后,指向标准命名空间的连接字符串将指向高级命名空间。After the migration is committed, the connection string that pointed to the standard namespace will point to the premium namespace.

发送方和接收方应用程序将断开到标准命名空间的连接,并自动重新连接到高级命名空间。The sender and receiver applications will disconnect from the standard Namespace and reconnect to the premium namespace automatically.

完成从标准到高级命名空间的迁移后需要执行哪些操作?What do I do after the standard to premium migration is complete?

从标准到高级命名空间的迁移可确保将标准命名空间中的实体元数据(例如主题、订阅和筛选器)复制到高级命名空间。The standard to premium migration ensures that the entity metadata such as topics, subscriptions, and filters are copied from the standard namespace to the premium namespace. 已提交到标准命名空间的消息数据不会从标准命名空间复制到高级命名空间。The message data that was committed to the standard namespace isn't copied from the standard namespace to the premium namespace.

在迁移进行期间,可能有一些消息发送并提交到了标准命名空间。The standard namespace may have some messages that were sent and committed while the migration was underway. 请手动清空标准命名空间中的这些消息,并手动将其发送到高级命名空间。Manually drain these messages from the standard Namespace and manually send them to the premium Namespace. 若要手动清空消息,请通过某个控制台应用或脚本,使用在迁移命令中指定的迁移后 DNS 名称来清空标准命名空间实体。To manually drain the messages, use a console app or a script that drains the standard namespace entities by using the Post Migration DNS name that you specified in the migration commands. 将这些消息发送到高级命名空间,以便接收方能够对其进行处理。Send these messages to the premium namespace so that they can be processed by the receivers.

清空消息后,删除标准命名空间。After the messages have been drained, delete the standard namespace.

重要

清空标准命名空间中的消息后,删除标准命名空间。After the messages from the standard namespace have been drained, delete the standard namespace. 此操作非常重要,因为最初引用标准命名空间的连接字符串现在引用高级命名空间。This is important because the connection string that initially referred to the standard namespace now refers to the premium namespace. 不再需要标准命名空间。You won't need the standard Namespace anymore. 删除已迁移的标准命名空间有助于避免今后发生混淆。Deleting the standard namespace that you migrated helps reduce later confusion.

停机时间预计有多长?How much downtime do I expect?

迁移过程会尽量减少应用程序的预计停机时间。The migration process is meant to reduce the expected downtime for the applications. 它将使用发送方和接收方应用程序用来指向新高级命名空间的连接字符串,从而减少停机时间。Downtime is reduced by using the connection string that the sender and receiver applications use to point to the new premium namespace.

应用程序经历的停机时间限制为更新 DNS 条目以指向高级命名空间所需的时间。The downtime that is experienced by the application is limited to the time it takes to update the DNS entry to point to the premium namespace. 停机时间大约为 5 分钟。Downtime is approximately 5 minutes.

执行迁移时是否需要更改任何配置?Do I have to make any configuration changes while doing the migration?

执行迁移不需要更改任何代码或配置。No, there are no code or configuration changes needed to do the migration. 迁移过程会自动映射发送方和接收方应用程序用来访问标准命名空间的连接字符串,使其充当高级命名空间的别名。The connection string that sender and receiver applications use to access the standard Namespace is automatically mapped to act as an alias for the premium namespace.

如果中止迁移,会发生什么情况?What happens when I abort the migration?

可以使用 Abort 命令或 Azure 门户来中止迁移。The migration can be aborted either by using the Abort command or by using the Azure portal.

Azure CLIAzure CLI

az servicebus migration abort --resource-group $resourceGroup --name $standardNamespace

Azure 门户Azure portal

中止流 - 中止同步 中止流 - 中止完成Abort flow - abort sync Abort flow - abort complete

中止迁移过程时,会中止将标准命名空间中的实体(主题、订阅和筛选器)复制到高级命名空间的过程,并破坏配对。When the migration process is aborted, it aborts the process of copying the entities (topics, subscriptions, and filters) from the standard to the premium namespace and breaks the pairing.

连接字符串不会更新为指向高级命名空间。The connection string isn't updated to point to the premium namespace. 现有应用程序像在开始迁移之前那样继续正常工作。Your existing applications continue to work as they did before you started the migration.

但是,这不会删除高级命名空间中的实体,也不会删除高级命名空间。However, it doesn't delete the entities on the premium namespace or delete the premium namespace. 如果你决定不继续迁移,请手动删除这些实体。Delete the entities manually if you decided not to move forward with the migration.

重要

如果你决定中止迁移,请删除为迁移预配的高级命名空间,以免产生资源费用。If you decide to abort the migration, delete the premium Namespace that you had provisioned for the migration so that you are not charged for the resources.

我不想清空消息。I don't want to have to drain the messages. 我该怎么办?What do I do?

在迁移正在进行且即将提交迁移之前,发送方应用程序可能已发送一些消息并且这些消息已提交到标准命名空间中的存储。There may be messages that are sent by the sender applications and committed to the storage on the standard Namespace while the migration is taking place and just before the migration is committed.

在迁移过程中,实际的消息数据/有效负载不会从标准命名空间复制到高级命名空间。During migration, the actual message data/payload isn't copied from the standard to the premium namespace. 必须手动清空消息,然后将其发送到高级命名空间。The messages have to be manually drained and then sent to the premium namespace.

但是,如果你可以在计划内维护/保养时段进行迁移,并且你不想手动清空并发送消息,请执行以下步骤:However, if you can migrate during a planned maintenance/housekeeping window, and you don't want to manually drain and send the messages, follow these steps:

  1. 停止发送方应用程序。Stop the sender applications. 接收方应用程序将处理当前位于标准命名空间中的消息,并清空队列。The receiver applications will process the messages that are currently in the standard namespace and will drain the queue.

  2. 在标准命名空间中的队列和订阅已清空后,遵循前面所述的过程执行从标准到高级命名空间的迁移。After the queues and subscriptions in the standard Namespace are empty, follow the procedure that is described earlier to execute the migration from the standard to the premium namespace.

  3. 迁移完成后,可以重启发送方应用程序。After the migration is complete, you can restart the sender applications.

  4. 现在,发送方和接收方会自动连接到高级命名空间。The senders and receivers will now automatically connect with the premium namespace.

    备注

    无需停止接收方应用程序即可迁移。You do not have to stop the receiver applications for the migration.

    迁移完成后,接收方应用程序将断开到标准命名空间的连接,并自动连接到高级命名空间。After the migration is complete, the receiver applications will disconnect from the standard namespace and automatically connect to the premium namespace.

后续步骤Next steps