启用捕获通过 Azure 事件中心流式处理的事件Enable capturing of events streaming through Azure Event Hubs

Azure 事件中心捕获用于自动将事件中心中的流数据传送到所选 Azure Blob 存储帐户。Azure Event Hubs Capture enables you to automatically deliver the streaming data in Event Hubs to an Azure Blob storage account of your choice.

可以使用 Azure 门户在创建事件中心时配置捕获。You can configure Capture at the event hub creation time using the Azure portal. 可以将数据捕获到 Azure Blob 存储容器或 Azure Data Lake Store Gen 2 帐户。You can either capture the data to an Azure Blob storage container, or to an Azure Data Lake Storage Gen 2 account.

有关详细信息,请参阅事件中心捕获概述For more information, see the Event Hubs Capture overview.

将数据捕获到 Azure 存储Capture data to Azure Storage

创建事件中心以后,即可在“创建事件中心”门户屏幕中单击“启用”按钮,以便启用捕获。 When you create an event hub, you can enable Capture by clicking the On button in the Create Event Hub portal screen. 然后在“捕获提供程序”框中单击“Azure 存储”,指定存储帐户和容器。 You then specify a Storage Account and container by clicking Azure Storage in the Capture Provider box. 由于事件中心捕获对存储使用服务到服务身份验证,因此无需指定存储连接字符串。Because Event Hubs Capture uses service-to-service authentication with storage, you do not need to specify a storage connection string. 资源选取器自动为存储帐户选择资源 URI。The resource picker selects the resource URI for your storage account automatically. 如果使用 Azure Resource Manager,必须以字符串形式显式提供此 URI。If you use Azure Resource Manager, you must supply this URI explicitly as a string.

默认时间窗口为 5 分钟。The default time window is 5 minutes. 最小值为 1,最大值为 15。The minimum value is 1, the maximum 15. 大小 窗口的范围为 10-500 MB。The Size window has a range of 10-500 MB.

![捕获的时间范围][1]![Time window for capture][1]

备注

可以允许或禁止当捕获时间段内未发生任何事件时发出空文件。You can enable or disable emitting empty files when no events occur during the Capture window.

  1. 请按照创建存储帐户一文创建 Azure 存储帐户。Follow Create a storage account article to create an Azure Storage account. 请在“高级”选项卡上将“分层命名空间”设置为“启用”,使其成为 Azure Data Lake Storage Gen 2 帐户 。Set Hierarchical namespace to Enabled on the Advanced tab to make it an Azure Data Lake Storage Gen 2 account.

  2. 创建事件中心时,请执行以下步骤:When creating an event hub, do the following steps:

    1. 将“捕获”设置为“打开” 。Select On for Capture.

    2. 选择“Azure 存储”作为捕获提供程序。Select Azure Storage as the capture provider. “捕获提供程序”对应的 Azure Data Lake Store 选项为 Azure Data Lake Storage Gen 1 。The Azure Data Lake Store option you see for the Capture provider is for the Gen 1 of Azure Data Lake Storage. 要使用 Azure Data Lake Storage Gen 2,请选择“Azure 存储”。To use a Gen 2 of Azure Data Lake Storage, you select Azure Storage.

    3. 选择“选择容器”按钮。Select the Select Container button.

      启用捕获到 Data Lake Storage Gen 2

  3. 从列表中选择 Azure Data Lake Storage Gen 2 帐户。Select the Azure Data Lake Storage Gen 2 account from the list.

    选择 Data Lake Storage Gen2

  4. 选择“容器”(Data Lake Storage Gen 2 中的文件系统)。Select the container (file system in Data Lake Storage Gen 2).

    在存储中选择文件系统

  5. 在“创建事件中心”页面上,选择“创建” 。On the Create Event Hub page, select Create.

    选择“创建”按钮

    备注

    你使用此用户界面 (UI) 在 Azure Data Lake Storage Gen 2 中创建的容器将显示在“存储资源管理器”中的“文件系统”下 。The container you create in a Azure Data Lake Storage Gen 2 using this user interface (UI) is shown under File systems in Storage Explorer. 同样,你在 Data Lake Storage Gen 2 帐户下创建的文件系统在此 UI 中将显示为容器。Similarly, the file system you create in a Data Lake Storage Gen 2 account shows up as a container in this UI.

在现有的事件中心添加或配置捕获Add or configure Capture on an existing event hub

可以在事件中心命名空间中的现有事件中心配置捕获。You can configure Capture on existing event hubs that are in Event Hubs namespaces. 若要对现有的事件中心启用“捕获”功能,或者要更改“捕获”设置,请单击命名空间以加载概览屏幕,然后单击要启用或更改“捕获”设置的事件中心。To enable Capture on an existing event hub, or to change your Capture settings, click the namespace to load the overview screen, then click the event hub for which you want to enable or change the Capture setting. 最后,单击已打开页面左侧的“捕获”选项,然后编辑设置,如以下各图所示:Finally, click the Capture option on the left side of the open page and then edit the settings, as shown in the following figures:

Azure Blob 存储Azure Blob Storage

![配置 Azure Blob 存储][2]![Configure Azure Blob Storage][2]

Azure Data Lake Storage Gen 2Azure Data Lake Storage Gen 2

配置 Azure Data Lake Storage Gen 2

后续步骤Next steps