将 Azure 事件中心命名空间移到另一个区域Move an Azure Event Hubs namespace to another region

在多种情况下,可能需要将现有事件中心命名空间从一个区域移到另一个区域。There are various scenarios in which you'd want to move your existing Event Hubs namespace from one region to another. 例如,可能需要创建一个具有相同配置的命名空间,以便进行测试。For example, you may want to create a namespace with the same configuration for testing.

备注

本文介绍如何导出现有事件中心命名空间的 Azure 资源管理器模板,然后使用该模板在另一个区域中创建具有相同配置设置的命名空间。This article shows you how to export an Azure Resource Manager template for an existing Event Hubs namespace and then use the template to create a namespace with same configuration settings in another region. 但是,此过程不会移动尚未处理的事件。However, this process doesn't move events that aren't processed yet. 你需要先处理原始命名空间中的事件,然后再将其删除。You need to process the events from the original namespace before deleting it.

先决条件Prerequisites

  • 确保帐户使用的服务和功能在目标区域中受支持。Ensure that the services and features that your account uses are supported in the target region.
  • 对于预览版功能,请确保你的订阅已列入目标区域的允许列表。For preview features, ensure that your subscription is whitelisted for the target region.
  • 如果已为命名空间中的事件中心启用“捕获功能”,请移动 Azure 存储或 Azure Data Lake Store Gen 2If you have capture feature enabled for event hubs in the namespace, move Azure Storage or Azure Data Lake Store Gen 2. 还可以按照与本文所述步骤类似的步骤,将包含存储和事件中心命名空间的资源组移到另一个区域。You can also move the resource group that contains both Storage and Event Hubs namespaces to the other region by following steps similar to the ones described in this article.

准备Prepare

若要开始,请导出资源管理器模板。To get started, export a Resource Manager template. 此模板包含描述事件中心命名空间的设置。This template contains settings that describe your Event Hubs namespace.

  1. 登录到 Azure 门户Sign in to the Azure portal.

  2. 选择“所有资源”,然后选择你的事件中心命名空间。Select All resources and then select your Event Hubs namespace.

  3. 选择“设置” > “导出模板”。 Select > Settings > Export template.

  4. 选择“导出模板”页中的“下载”。 Choose Download in the Export template page.

    下载资源管理器模板

  5. 找到从门户下载的 .zip 文件,并将该文件解压缩到所选的文件夹。Locate the .zip file that you downloaded from the portal, and unzip that file to a folder of your choice.

    此 zip 文件包含 .json 文件,后者包括模板和用于部署模板的脚本。This zip file contains the .json files that include the template and scripts to deploy the template.

移动Move

部署模板以在目标区域中创建事件中心命名空间。Deploy the template to create an Event Hubs namespace in the target region.

  1. 在 Azure 门户中,选择“创建资源”。In the Azure portal, select Create a resource.

  2. 在“搜索市场”中键入“模板部署”,然后按 ENTERIn Search the Marketplace, type template deployment, and then press ENTER.

  3. 选择“模板部署”。Select Template deployment.

  4. 选择“创建” 。Select Create.

  5. 选择“在编辑器中生成自己的模板”。Select Build your own template in the editor.

  6. 选择“加载文件”,然后按说明加载在上一部分下载的 template.json 文件。Select Load file, and then follow the instructions to load the template.json file that you downloaded in the last section.

  7. 选择“保存”以保存该模板。Select Save to save the template.

  8. 在“自定义部署”页上执行以下步骤:On the Custom deployment page, follow these steps:

    1. 选择 Azure 订阅。Select an Azure subscription.

    2. 选择现有的资源组或创建一个资源组。Select an existing resource group or create one. 如果源命名空间位于事件中心群集中,请在目标区域中选择包含群集的资源组。If the source namespace was in an Event Hubs cluster, select the resource group that contains cluster in the target region.

    3. 选择目标位置或区域。Select the target location or region. 如果选择了现有资源组,则此设置为只读。If you selected an existing resource group, this setting is read-only.

    4. 在“设置”部分中,执行以下步骤:In the SETTINGS section, do the following steps:

      1. 输入新命名空间名称。enter the new namespace name.

        部署资源管理器模板

      2. 如果源命名空间位于事件中心群集中,请输入资源组和事件中心群集的名称,作为“外部 ID”的一部分。If your source namespace was in an Event Hubs cluster, enter names of resource group and Event Hubs cluster as part of external ID.

        /subscriptions/<AZURE SUBSCRIPTION ID>/resourceGroups/<CLUSTER'S RESOURCE GROUP>/providers/Microsoft.EventHub/clusters/<CLUSTER NAME>
        
      3. 如果命名空间中的事件中心使用存储帐户来捕获事件,请为 StorageAccounts_<original storage account name>_external 字段指定资源组名称和存储帐户。If event hub in your namespace uses a Storage account for capturing events, specify the resource group name and the storage account for StorageAccounts_<original storage account name>_external field.

        /subscriptions/0000000000-0000-0000-0000-0000000000000/resourceGroups/<STORAGE'S RESOURCE GROUP>/providers/Microsoft.Storage/storageAccounts/<STORAGE ACCOUNT NAME>
        
    5. 选择“我同意上述条款和条件”复选框。Select the I agree to the terms and conditions stated above checkbox.

    6. 现在,选择“选择购买”以启动部署过程。Now, select Select Purchase to start the deployment process.

丢弃或清理Discard or clean up

部署后,如果要重新开始,则可以删除目标事件中心命名空间,并重复执行本文的准备移动部分中所述的步骤。After the deployment, if you want to start over, you can delete the target Event Hubs namespace, and repeat the steps described in the Prepare and Move sections of this article.

若要提交更改并完成事件中心命名空间的移动,请删除源事件中心命名空间。To commit the changes and complete the move of an Event Hubs namespace, delete the source Event Hubs namespace. 请确保在删除命名空间前处理了该命名空间中的所有事件。Make sure that you processed all the events in the namespace before deleting the namespace.

若要使用 Azure 门户删除事件中心命名空间(源或目标),请执行以下操作:To delete an Event Hubs namespace (source or target) by using the Azure portal:

  1. 在 Azure 门户顶部的搜索窗口中,键入“事件中心”,然后从搜索结果中选择“事件中心”。In the search window at the top of Azure portal, type Event Hubs, and select Event Hubs from search results. 此时会在列表中看到事件中心命名空间。You see the Event Hubs namespaces in a list.

  2. 选择要删除的目标命名空间,并从工具栏中选择“删除”。Select the target namespace to delete, and select Delete from the toolbar.

    删除命名空间 - 按钮

  3. 在“删除资源”页上,验证所选资源,并键入“是”确认删除,然后选择“删除”。On the Delete Resources* page, verify the selected resources, and confirm the deletion by typing yes, and then select Delete.

后续步骤Next steps

在本教程中,你已将一个 Azure 事件中心命名空间从一个区域移到了另一个区域,并清理了源资源。In this tutorial, you moved an Azure Event Hubs namespace from one region to another and cleaned up the source resources. 若要详细了解如何在区域之间移动资源,以及如何在 Azure 中进行灾难恢复,请参阅:To learn more about moving resources between regions and disaster recovery in Azure, refer to: