事件中心常见问题Event Hubs frequently asked questions


什么是事件中心命名空间?What is an Event Hubs namespace?

命名空间是事件中心/Kafka 主题的范围容器。A namespace is a scoping container for Event Hub/Kafka Topics. 它提供唯一的 FQDN。It gives you a unique FQDN. 命名空间充当容装多个事件中心/Kafka 主题的应用程序容器。A namespace serves as an application container that can house multiple Event Hub/Kafka Topics.

何时创建新的命名空间与使用现有命名空间?When do I create a new namespace vs. use an existing namespace?

容量分配(吞吐量单位 (TU))在命名空间级别进行计费。Capacity allocations (throughput units (TUs)) are billed at the namespace level. 命名空间也与区域相关联。A namespace is also associated with a region.

在以下任一情况下,你可能希望创建新的命名空间,而不是使用现有的命名空间:You may want to create a new namespace instead of using an existing one in one of the following scenarios:

  • 需要与新区域关联的事件中心。You need an Event Hub associated with a new region.
  • 需要与其他订阅关联的事件中心。You need an Event Hub associated with a different subscription.
  • 需要一个具有不同容量分配的事件中心(即,具有添加的事件中心的命名空间的容量需求将超过 40 TU 阈值,并且你不希望使用专用群集)You need an Event Hub with a distinct capacity allocation (that is, the capacity need for the namespace with the added event hub would exceed the 40 TU threshold and you don't want to go for the dedicated cluster)

事件中心基本和标准这两种服务层有什么不同?What is the difference between Event Hubs Basic and Standard tiers?

Azure 事件中心标准层提供的功能超出了基本层中提供的功能。The Standard tier of Azure Event Hubs provides features beyond what is available in the Basic tier. 以下功能是标准层附带的:The following features are included with Standard:

  • 更长的事件保留期Longer event retention
  • 其他中转连接,对于超出包含的数量的部分收取超额费用Additional brokered connections, with an overage charge for more than the number included
  • 多于单个使用者组More than a single consumer group
  • 捕获Capture

有关定价层的详细信息(包括专用事件中心),请参阅事件中心定价详细信息For more information about pricing tiers, including Event Hubs Dedicated, see the Event Hubs pricing details.

Azure 事件中心在哪些区域可用?Where is Azure Event Hubs available?

在所有支持的 Azure 区域中都可使用 Azure 事件中心。Azure Event Hubs is available in all supported Azure regions. 有关列表,请访问 Azure 区域页。For a list, visit the Azure regions page.

是否可以使用单个高级消息队列协议 (AMQP) 连接来与多个事件中心相互收发数据?Can I use a single Advanced Message Queuing Protocol (AMQP) connection to send and receive from multiple event hubs?

可以,但前提是所有事件中心都在同一个命名空间中。Yes, as long as all the event hubs are in the same namespace.

事件的最长保留期有多久?What is the maximum retention period for events?

事件中心标准版目前支持的最长保留期为七天。Event Hubs Standard tier currently supports a maximum retention period of seven days. 事件中心不应作为永久性的数据存储。Event hubs aren't intended as a permanent data store. 大于 24 小时的保留期适用于将事件流重播到相同系统中的情形。Retention periods greater than 24 hours are intended for scenarios in which it's convenient to replay an event stream into the same systems. 例如,基于现有数据训练或验证新机器学习模型。For example, to train or verify a new machine learning model on existing data. 如果需要将消息保留七天以上,请启用事件中心的事件中心捕获功能,将数据从事件中心提取到所选的存储帐户或 Azure Data Lake 服务帐户。If you need message retention beyond seven days, enabling Event Hubs Capture on your event hub pulls the data from your event hub into the Storage account or Azure Data Lake Service account of your choosing. 启用捕获功能需要支付费用,具体因购买的吞吐量单位而异。Enabling Capture incurs a charge based on your purchased throughput units.

可以在存储帐户上配置已捕获数据的保留期。You can configure the retention period for the captured data on your storage account. Azure 存储的“生命周期管理”功能为常规用途 v2 和 blob 存储帐户提供了基于规则的丰富策略。The lifecycle management feature of Azure Storage offers a rich, rule-based policy for general purpose v2 and blob storage accounts. 可使用该策略将数据转移到适当的访问层,或在数据的生命周期结束时使数据过期。Use the policy to transition your data to the appropriate access tiers or expire at the end of the data's lifecycle. 有关详细信息,请参阅管理 Azure Blob 存储生命周期For more information, see Manage the Azure Blob storage lifecycle.

如何监视事件中心?How do I monitor my Event Hubs?

事件中心向 Azure Monitor 发出详尽指标用于提供资源的状态。Event Hubs emits exhaustive metrics that provide the state of your resources to Azure Monitor. 此外,参考指标不仅可以在命名空间级别,而且还能在实体级别评估事件中心服务的总体运行状况。They also let you assess the overall health of the Event Hubs service not only at the namespace level but also at the entity level. 了解 Azure 事件中心提供哪些监视功能。Learn about what monitoring is offered for Azure Event Hubs.

Azure 事件中心将数据存储在何处?Where does Azure Event Hubs store data?

Azure 事件中心标准层和专用层在你选择的区域中存储元数据和数据。Azure Event Hubs standard and dedicated tiers store metadata and data in regions that you select. 为 Azure 事件中心命名空间设置异地灾难恢复时,会将元数据复制到你选择的次要区域。When geo-disaster recovery is set up for an Azure Event Hubs namespace, metadata is copied over to the secondary region that you select. 因此,此服务会自动满足区域内数据驻留要求,包括信任中心内指定的要求。Therefore, this service automatically satisfies the region data residency requirements including the ones specified in the Trust Center.

需要在防火墙上打开哪些端口?What ports do I need to open on the firewall?

可以将以下协议与 Azure 事件中心配合使用,以便发送和接收事件:You can use the following protocols with Azure Event Hubs to send and receive events:

  • 高级消息队列协议 1.0 (AMQP)Advanced Message Queuing Protocol 1.0 (AMQP)
  • 具有 TLS 的超文本传输协议 1.1 (HTTPS)Hypertext Transfer Protocol 1.1 with TLS (HTTPS)
  • Apache KafkaApache Kafka

请查看下表,了解需要打开哪些出站端口,以便使用这些协议与 Azure 事件中心通信。See the following table for the outbound ports you need to open to use these protocols to communicate with Azure Event Hubs.

协议Protocol 端口Ports 详细信息Details
AMQPAMQP 5671 和 56725671 and 5672 请参阅 AMQP 协议指南See AMQP protocol guide
HTTPSHTTPS 443443 此端口用于 HTTP/REST API 和 AMQP-over-WebSockets。This port is used for the HTTP/REST API and for AMQP-over-WebSockets.
KafkaKafka 90939093 请参阅使用 Kafka 应用程序中的事件中心See Use Event Hubs from Kafka applications

通过端口 5671 使用 AMQP 时,还需要使用 HTTPS 端口进行出站通信,因为客户端 SDK 执行的一些管理操作和从 Azure Active Directory(使用时)获取令牌的操作都是通过 HTTPS 运行的。The HTTPS port is required for outbound communication also when AMQP is used over port 5671, because several management operations performed by the client SDKs and the acquisition of tokens from Azure Active Directory (when used) run over HTTPS.

正式的 Azure SDK 通常使用 AMQP 协议通过事件中心发送和接收事件。The official Azure SDKs generally use the AMQP protocol for sending and receiving events from Event Hubs. 与 HTTP API 一样,AMQP-over-WebSockets 协议选项通过端口 TCP 443 运行,但在功能上与普通 AMQP 相同。The AMQP-over-WebSockets protocol option runs over port TCP 443 just like the HTTP API, but is otherwise functionally identical with plain AMQP. 由于额外的握手往返,此选项的初始连接延迟较高,并且作为共享 HTTPS 端口的折衷方案,此选项的开销略高。This option has higher initial connection latency because of extra handshake round trips and slightly more overhead as tradeoff for sharing the HTTPS port. 如果选择此模式,TCP 端口 443 足以进行通信。If this mode is selected, TCP port 443 is sufficient for communication. 以下选项允许选择普通 AMQP 或 AMQP WebSockets 模式:The following options allow selecting the plain AMQP or AMQP WebSockets mode:

语言Language 选项Option
.NET.NET 具有 EventHubsTransportType.AmqpTcpEventHubsTransportType.AmqpWebSocketsEventHubConnectionOptions.TransportType 属性EventHubConnectionOptions.TransportType property with EventHubsTransportType.AmqpTcp or EventHubsTransportType.AmqpWebSockets
JavaJava 具有 AmqpTransportType.AMQPAmqpTransportType.AMQP_WEB_SOCKETScom.microsoft.azure.eventhubs.EventProcessorClientBuilder.transporttypecom.microsoft.azure.eventhubs.EventProcessorClientBuilder.transporttype with AmqpTransportType.AMQP or AmqpTransportType.AMQP_WEB_SOCKETS
节点Node EventHubConsumerClientOptions 具有 webSocketOptions 属性。EventHubConsumerClientOptions has a webSocketOptions property.
PythonPython 具有 TransportType.AmqpTransportType.AmqpOverWebSocketEventHubConsumerClient.transport_typeEventHubConsumerClient.transport_type with TransportType.Amqp or TransportType.AmqpOverWebSocket

需要允许哪些 IP 地址?What IP addresses do I need to allow?

使用 Azure 时,有时必须在公司防火墙或代理中允许特定的 IP 地址范围或 URL 才能访问你正在使用或尝试使用的所有 Azure 服务。When you are working with Azure, sometimes you have to allow specific IP address ranges or URLs in your corporate firewall or proxy to access all Azure services you are using or trying to use. 确认在事件中心使用的 IP 地址上是否允许该流量。Verify that the traffic is allowed on IP addresses used by Event Hubs. 有关 Azure 事件中心使用的 IP 地址:请参阅 Azure IP 范围和服务标记 - 公有云For IP addresses used by Azure Event Hubs: see Azure IP Ranges and Service Tags - Public Cloud.

另外,请验证是否允许你的命名空间的 IP 地址。Also, verify that the IP address for your namespace is allowed. 若要查找允许你的连接的正确 IP 地址,请执行以下步骤:To find the right IP addresses to allow for your connections, follow these steps:

  1. 从命令提示符处运行以下命令:Run the following command from a command prompt:

    nslookup <YourNamespaceName>.servicebus.chinacloudapi.cn
  2. 记下 Non-authoritative answer 中返回的 IP 地址。Note down the IP address returned in Non-authoritative answer.

如果对命名空间使用区域冗余,则需执行一些额外的步骤:If you use the zone redundancy for your namespace, you need to do a few extra steps:

  1. 首先,在命名空间中运行 nslookup。First, you run nslookup on the namespace.

    nslookup <yournamespace>.servicebus.chinacloudapi.cn
  2. 记下“非权威回答”部分中的名称,该名称采用下述格式之一:Note down the name in the non-authoritative answer section, which is in one of the following formats:

  3. 为每一个运行 nslookup,使用后缀 s1、s2 和 s3 获取所有三个在三个可用性区域中运行的实例的 IP 地址。Run nslookup for each one with suffixes s1, s2, and s3 to get the IP addresses of all three instances running in three availability zones,


    nslookup 命令返回的 IP 地址不是静态 IP 地址。The IP address returned by the nslookup command isn't a static IP address. 但是,在删除基础部署或将其移至其他群集之前,该地址保持不变。However, it remains constant until the underlying deployment is deleted or moved to a different cluster.

哪些客户端 IP 正在向/从我的命名空间发送/接收事件?What client IPs are sending events to or receiving events from my namespace?

首先,在命名空间上启用 IP 筛选First, enable IP filtering on the namespace.

然后,按照启用诊断日志中的说明,为事件中心虚拟网络连接事件启用诊断日志。Then, Enable diagnostic logs for Event Hubs virtual network connection events by following instructions in the Enable diagnostic logs. 你将看到连接遭到拒绝的 IP 地址。You'll see the IP address for which connection is denied.

    "SubscriptionId": "0000000-0000-0000-0000-000000000000",
    "NamespaceName": "namespace-name",
    "IPAddress": "",
    "Action": "Deny Connection",
    "Reason": "IPAddress doesn't belong to a subnet with Service Endpoint enabled.",
    "Count": "65",
    "ResourceId": "/subscriptions/0000000-0000-0000-0000-000000000000/resourcegroups/testrg/providers/microsoft.eventhub/namespaces/namespace-name",
    "Category": "EventHubVNetConnectionEvent"


只有当命名空间允许从特定的 IP 地址(IP 筛选器规则)进行访问时,才会生成虚拟网络日志。Virtual network logs are generated only if the namespace allows access from specific IP addresses (IP filter rules). 如果不希望使用这些功能限制对命名空间的访问,但仍希望获取虚拟网络日志来跟踪连接到事件中心命名空间的客户端的 IP 地址,则可以使用以下解决方法:启用 IP 筛选并添加整个可寻址 IPv4 范围 ( -。If you don't want to restrict access to your namespace using these features and still want to get virtual network logs to track IP addresses of clients connecting to the Event Hubs namespace, you could use the following workaround: Enable IP filtering, and add the total addressable IPv4 range ( - 事件中心不支持 IPv6 地址范围。Event Hubs doesn't support IPv6 address ranges.


目前,无法确定单个消息或事件的源 IP。Currently, it's not possible to determine the source IP of an individual message or event.

Apache Kafka 集成Apache Kafka integration

如何将现有的 Kafka 应用程序与事件中心集成?How do I integrate my existing Kafka application with Event Hubs?

事件中心提供可由基于 Apache Kafka 的现有应用程序使用的 Kafka 终结点。Event Hubs provides a Kafka endpoint that can be used by your existing Apache Kafka based applications. 只需完成一项配置更改,即可获得 PaaS Kafka 体验。A configuration change is all that is required to have the PaaS Kafka experience. 使用该体验就如同运行自己的 Kafka 群集。It provides an alternative to running your own Kafka cluster. 事件中心支持 Apache Kafka 1.0 和更高版本的客户端,并且适用于现有的 Kafka 应用程序、工具和框架。Event Hubs supports Apache Kafka 1.0 and newer client versions and works with your existing Kafka applications, tools, and frameworks. 有关详细信息,请参阅适用于 Kafka 的事件中心存储库For more information, see Event Hubs for Kafka repo.

要使现有的应用程序与事件中心通信,需要完成哪些配置更改?What configuration changes need to be done for my existing application to talk to Event Hubs?

要连接到事件中心,需要更新 Kafka 客户端配置。To connect to an event hub, you'll need to update the Kafka client configs. 为此,可以创建事件中心命名空间并获取连接字符串It's done by creating an Event Hubs namespace and obtaining the connection string. 更改 bootstrap.servers,以将事件中心 FQDN 和端口指向 9093。Change the bootstrap.servers to point the Event Hubs FQDN and the port to 9093. 更新 sasl.jaas.config,以使用正确的身份验证将 Kafka 客户端定向到事件中心终结点(已获取的连接字符串),如下所示:Update the sasl.jaas.config to direct the Kafka client to your Event Hubs endpoint (which is the connection string you've obtained), with correct authentication as shown below:

sasl.jaas.config=org.apache.kafka.common.security.plain.PlainLoginModule required username="$ConnectionString" password="{YOUR.EVENTHUBS.CONNECTION.STRING}";


sasl.jaas.config=org.apache.kafka.common.security.plain.PlainLoginModule required username="$ConnectionString" password="Endpoint=sb://dummynamespace.servicebus.chinacloudapi.cn/;SharedAccessKeyName=DummyAccessKeyName;SharedAccessKey=XXXXXXXXXXXXXXXXXXXXX";

注意:如果 sasl.jaas.config 在框架中不是受支持的配置,请查找用于设置 SASL 用户名和密码的配置,改为使用这些配置。Note: If sasl.jaas.config isn't a supported configuration in your framework, find the configurations that are used to set the SASL username and password and use them instead. 将用户名设置为 $ConnectionString,将密码设置为事件中心连接字符串。Set the username to $ConnectionString and the password to your Event Hubs connection string.

事件中心的消息/事件大小是多少?What is the message/event size for Event Hubs?

事件中心允许的最大消息大小为 1 MB。The maximum message size allowed for Event Hubs is 1 MB.

吞吐量单位Throughput units

什么是事件中心吞吐量单元?What are Event Hubs throughput units?

事件中心内的吞吐量定义通过事件中心传入和传出的数据量,以 MB 或者 1-KB 事件的数目(以千计)为单位。Throughput in Event Hubs defines the amount of data in mega bytes or the number (in thousands) of 1-KB events that ingress and egress through Event Hubs. 此吞吐量以吞吐量单位 (TU) 来计量。This throughput is measured in throughput units (TUs). 在开始使用事件中心服务之前,需购买 TU。Purchase TUs before you can start using the Event Hubs service. 可以使用门户或事件中心资源管理器模板显式选择事件中心 TU。You can explicitly select Event Hubs TUs either by using portal or Event Hubs Resource Manager templates.

吞吐量单位是否适用于命名空间中的所有事件中心?Do throughput units apply to all event hubs in a namespace?

是的,吞吐量单位 (TU) 适用于事件中心命名空间中的所有事件中心。Yes, throughput units (TUs) apply to all event hubs in an Event Hubs namespace. 这意味着,TU 是在命名空间级别购买的,并在该命名空间下的事件中心之间共享。It means that you purchase TUs at the namespace level and are shared among the event hubs under that namespace. 每个 TU 为命名空间赋予以下功能:Each TU entitles the namespace to the following capabilities:

  • 入口事件(发送到事件中心的事件)最多为每秒 1 MB,但每秒不超过 1000 个入口事件、管理操作或控制 API 调用。Up to 1 MB per second of ingress events (events sent into an event hub), but no more than 1000 ingress events, management operations, or control API calls per second.
  • 出口事件(从事件中心使用的事件)最多达每秒 2 MB,但不超过 4096 个。Up to 2 MB per second of egress events (events consumed from an event hub), but no more than 4096 egress events.
  • 事件存储空间最多为 84 GB(对于默认的 24 小时保留期而言已足够)。Up to 84 GB of event storage (enough for the default 24-hour retention period).

吞吐量单位如何计费?How are throughput units billed?

吞吐量单位 (TU) 按小时计费。Throughput units (TUs) are billed on an hourly basis. 计费基于在给定的小时选择的最大单位数目。The billing is based on the maximum number of units that was selected during the given hour.

如何优化吞吐量单位的使用?How can I optimize the usage on my throughput units?

可以从最少的一个吞吐量单位 (TU) 着手,并启用自动扩充You can start as low as one throughput unit (TU), and turn on auto-inflate. 自动扩充功能可让你在流量/有效负载增大时扩展 TU。The auto-inflate feature lets you grow your TUs as your traffic/payload increases. 还可以针对 TU 数量设置上限。You can also set an upper limit on the number of TUs.

事件中心自动扩充功能的工作原理是什么?How does Auto-inflate feature of Event Hubs work?

使用自动扩充功能可以纵向扩展吞吐量单位 (TU)。The auto-inflate feature lets you scale up your throughput units (TUs). 这意味着,一开始可以购买较低的 TU,自动扩充会在入口流量增大时纵向扩展 TU。It means that you can start by purchasing low TUs and auto-inflate scales up your TUs as your ingress increases. 自动扩充是一种经济高效的选项,可让你完全控制 TU 数量。It gives you a cost-effective option and complete control of the number of TUs to manage. 这是一个 仅限纵向扩展 的功能,可以通过更新来完全控制 TU 数量的缩减。This feature is a scale-up only feature, and you can completely control the scaling down of the number of TUs by updating it.

可以从较低的吞吐量单位 (TU) 着手,例如 2 个 TU。You may want to start with low throughput units (TUs), for example, 2 TUs. 如果预测流量可能会增大到 15 TU,请对命名空间启用自动扩充功能,并将最大限制设置为 15 TU。If you predict that your traffic may grow to 15 TUs, turn-on the auto-inflate feature on your namespace, and set the max limit to 15 TUs. 现在,当流量增大时可以自动扩展 TU。You can now grow your TUs automatically as your traffic grows.

启用自动扩充功能是否会产生相关的费用?Is there a cost associated when I turn on the auto-inflate feature?

此功能 不会 产生相关的费用。There's no cost associated with this feature.

如何强制实施吞吐量限制?How are throughput limits enforced?

如果某个命名空间中所有事件中心间的总入口吞吐量或总入口事件率超过了聚合吞吐量单位限额,那么发送方会受到限制,并会收到指明已超出入口配额的错误信息。If the total ingress throughput or the total ingress event rate across all event hubs in a namespace exceeds the aggregate throughput unit allowances, senders are throttled and receive errors indicating that the ingress quota has been exceeded.

如果某个命名空间中所有事件中心间的总出口吞吐量或总出口事件率超过了聚合吞吐量单位限额,那么接收方会受到限制,但不会生成任何限制错误。If the total egress throughput or the total event egress rate across all event hubs in a namespace exceeds the aggregate throughput unit allowances, receivers are throttled but no throttling errors are generated.

入口和出口配额是分开强制实施的,因此,任何发送方都不会使事件耗用速度减慢,并且接收方也无法阻止事件发送到事件中心。Ingress and egress quotas are enforced separately, so that no sender can cause event consumption to slow down, nor can a receiver prevent events from being sent into an event hub.

可预留/选择的吞吐量单位数量是否有限制?Is there a limit on the number of throughput units that can be reserved/selected?

在 Azure 门户中创建基本层或标准层命名空间时,最多可以为命名空间选择 20 个 TU。When creating a basic or a standard tier namespace in the Azure portal, you can select up to 20 TUs for the namespace. 若要将 TU 提升到正好 40 个,请提交一个支持请求To raise it to exactly 40 TUs, submit a support request.

  1. 在“事件总线命名空间”页面上,选择左侧菜单上的“新建支持请求” 。On the Event Bus Namespace page, select New support request on the left menu.
  2. 在“新建支持请求”页面上,按照以下步骤操作:On the New support request page, follow these steps:
    1. 对于“摘要”,用几句话描述这个问题。For Summary, describe the issue in a few words.

    2. 对于“问题类型”,请选择“配额”。For Problem type, select Quota.

    3. 对于“问题子类型”,选择“吞吐量单位增加或减少请求” 。For Problem subtype, select Request for throughput unit increase or decrease.


如果超出 40 TU,事件中心可提供名为“事件中心专用群集”的基于资源/容量的模型。Beyond 40 TUs, Event Hubs offers the resource/capacity-based model called the Event Hubs Dedicated clusters. 专用群集按容量单位 (CU) 销售。Dedicated clusters are sold in Capacity Units (CUs). 有关详细信息,请参阅事件中心专用层 - 概述For more information, see Event Hubs Dedicated - overview.

专用群集Dedicated clusters

什么是事件中心专用群集?What are Event Hubs Dedicated clusters?

事件中心专用群集提供单租户部署来满足苛刻的客户要求。Event Hubs Dedicated clusters offer single-tenant deployments for customers with most demanding requirements. 此产品/服务会构建一个不受限于吞吐量单位的基于容量的群集。This offering builds a capacity-based cluster that is not bound by throughput units. 这意味着,可以使用该群集,根据群集的 CPU 和内存用量情况来引入和流式传输数据。It means that you could use the cluster to ingest and stream your data as dictated by the CPU and memory usage of the cluster. 有关详细信息,请参阅事件中心专用群集For more information, see Event Hubs Dedicated clusters.

What can I achieve with a cluster?

For an Event Hubs cluster, how much you can ingest and stream depends on various factors such as your producers, consumers, the rate at which you're ingesting and processing, and much more.

The following table shows the benchmark results that we achieved during our testing:

Payload shape Receivers Ingress bandwidth Ingress messages Egress bandwidth Egress messages Total TUs TUs per CU
Batches of 100x1KB 2 400 MB/sec 400k messages/sec 800 MB/sec 800k messages/sec 400 TUs 100 TUs
Batches of 10x10KB 2 666 MB/sec 66.6k messages/sec 1.33 GB/sec 133k messages/sec 666 TUs 166 TUs
Batches of 6x32KB 1 1.05 GB/sec 34k messages / sec 1.05 GB/sec 34k messages/sec 1000 TUs 250 TUs

In the testing, the following criteria was used:

  • A dedicated-tier Event Hubs cluster with four capacity units (CUs) was used.
  • The event hub used for ingestion had 200 partitions.
  • The data that was ingested was received by two receiver applications receiving from all partitions.

Can I scale up/down my cluster?

After creation, clusters are billed for a minimum of 4 hours of usage. In the Preview release of the self-serve experience, you can submit a support request to the Event Hubs team under Technical > Quota > Request to Scale Up or Scale Down Dedicated Cluster to scale your cluster up or down. It may take up to 7 days to complete the request to scale down your cluster.

How does Geo-DR work with my cluster?

You can geo-pair a namespace under a Dedicated-tier cluster with another namespace under a Dedicated-tier cluster. We don't encourage pairing a dedicated-tier namespace with a namespace in our standard offering because the throughput limit will be incompatible and result in errors.

Can I migrate my Standard namespaces to belong to a Dedicated-tier cluster?

We don't currently support an automated migration process for migrating your event hubs data from a Standard namespace to a Dedicated one.


需要多少分区?How many partitions do I need?

分区数在创建时指定,并且必须介于 1 和 32 之间。The number of partitions is specified at creation and must be between 1 and 32. 专用层以外,所有层的分区计数均不可更改,因此在设置分区计数时应考虑长期规模。The partition count isn't changeable in all tiers except the dedicated tier, so you should consider long-term scale when setting partition count. 分区是一种数据组织机制,与使用方应用程序中所需的下游并行度相关。Partitions are a data organization mechanism that relates to the downstream parallelism required in consuming applications. 事件中心的分区数与预期会有的并发读取者数直接相关。The number of partitions in an event hub directly relates to the number of concurrent readers you expect to have. 有关分区的详细信息,请参阅分区For more information on partitions, see Partitions.

你可能希望在创建时将其设置为最高可能值,即 32。You may want to set it to be the highest possible value, which is 32, at the time of creation. 请记住,拥有多个分区将导致事件发送到多个分区而不保留顺序,除非你将发送方配置为仅发送到 32 个分区中的一个分区,剩下的 31 个分区是冗余分区。Remember that having more than one partition will result in events sent to multiple partitions without retaining the order, unless you configure senders to only send to a single partition out of the 32 leaving the remaining 31 partitions redundant. 在前一种情况下,必须跨所有 32 个分区读取事件。In the former case, you'll have to read events across all 32 partitions. 在后一种情况下,除了必须在事件处理器主机上进行额外配置外,没有明显的额外成本。In the latter case, there's no obvious additional cost apart from the extra configuration you have to make on Event Processor Host.

事件中心设计用于允许每个用户组使用单个分区读取器。Event Hubs is designed to allow a single partition reader per consumer group. 在大多数用例中,四个分区的默认设置就足够了。In most use cases, the default setting of four partitions is sufficient. 如果希望扩展事件处理,则可以考虑添加其他分区。If you're looking to scale your event processing, you may want to consider adding additional partitions. 对分区没有特定的吞吐量限制,但是命名空间中的聚合吞吐量受吞吐量单位数限制。There's no specific throughput limit on a partition, however the aggregate throughput in your namespace is limited by the number of throughput units. 增加命名空间中吞吐量单位的数量时,可能需要添加额外分区来允许并发读取器实现其自身的最大吞吐量。As you increase the number of throughput units in your namespace, you may want additional partitions to allow concurrent readers to achieve their own maximum throughput.

但是,如果有一个模型,其中应用程序具有到特定分区的关联性,则增加分区数可能对你没有任何益处。However, if you have a model in which your application has an affinity to a particular partition, increasing the number of partitions may not be of any benefit to you. 有关详细信息,请参阅可用性和一致性For more information, see availability and consistency.

增加分区数Increase partitions

通过提交支持请求,你可以请求将分区计数增加到 40(精确)。You can request for the partition count to be increased to 40 (exact) by submitting a support request.

  1. 在“事件总线命名空间”页面上,选择左侧菜单上的“新建支持请求” 。On the Event Bus Namespace page, select New support request on the left menu.
  2. 在“新建支持请求”页面上,按照以下步骤操作:On the New support request page, follow these steps:
    1. 对于“摘要”,用几句话描述这个问题。For Summary, describe the issue in a few words.

    2. 对于“问题类型”,请选择“配额”。For Problem type, select Quota.

    3. 对于“问题子类型”,选择“分区更改请求” 。For Problem subtype, select Request for partition change.


分区计数可以增加到正好 40 个。The partition count can be increased to exactly 40. 在这种情况下,TU 的数量也必须增加到 40 个。In this case, number of TUs also have to be increased to 40. 如果你稍后决定将 TU 限制降低到 <= 20 个,那么最大分区限制也将减少到 32 个。If you decide later to lower the TU limit back to <= 20, the maximum partition limit is also decreased to 32.

减少分区数不会影响现有的事件中心,因为分区数只在事件中心级别应用,在创建该中心之后是不可变的。The decrease in partitions doesn't affect existing event hubs because partitions are applied at the event hub level and they're immutable after creation of the hub.


我可以在哪里找到更多定价信息?Where can I find more pricing information?

有关事件中心定价的完整信息,请参阅事件中心定价详细信息For complete information about Event Hubs pricing, see the Event Hubs pricing details.

保留事件中心事件超过 24 小时的话,要收取费用吗?Is there a charge for retaining Event Hubs events for more than 24 hours?

事件中心标准层允许消息保留期长于 24 小时,最长以 7 天为限。The Event Hubs Standard tier does allow message retention periods longer than 24 hours, for a maximum of seven days. 如果所存储事件总量的大小超过所选吞吐量单位数量的存储限制(每个吞吐量单位 84 GB),超出限制的部分会按公布的 Azure Blob 存储区费率收费。If the size of the total number of stored events exceeds the storage allowance for the number of selected throughput units (84 GB per throughput unit), the size that exceeds the allowance is charged at the published Azure Blob storage rate. 每个吞吐量单元的存储限制包括 24 小时(默认值)的保留期期间的所有存储成本,即使吞吐量单元已经用到了最大入口限制。The storage allowance in each throughput unit covers all storage costs for retention periods of 24 hours (the default) even if the throughput unit is used up to the maximum ingress allowance.

怎样对事件中心存储区大小进行计算和收费?How is the Event Hubs storage size calculated and charged?

所有存储的事件的总大小(包括所有事件中心内事件标头或磁盘存储器结构上的所有内部开销)按整天计量。The total size of all stored events, including any internal overhead for event headers or on disk storage structures in all event hubs, is measured throughout the day. 在一天结束时,计算存储区大小峰值。At the end of the day, the peak storage size is calculated. 每天的存储限制根据在当天所选择的吞吐量单元的最小数量(每个吞吐量单元提供 84 GB 的限制)来计算。The daily storage allowance is calculated based on the minimum number of throughput units that were selected during the day (each throughput unit provides an allowance of 84 GB). 如果总大小超过计算出的每日存储限额,超出的存储量会采用 Azure Blob 存储费率(按 本地冗余存储 费率)来计费。If the total size exceeds the calculated daily storage allowance, the excess storage is billed using Azure Blob storage rates (at the Locally Redundant Storage rate).

事件中心入口事件是怎样计算的?How are Event Hubs ingress events calculated?

发送到事件中心的每个事件均计为一条可计费消息。Each event sent to an event hub counts as a billable message. 入口事件 定义为小于等于 64 KB 的数据单位。An ingress event is defined as a unit of data that is less than or equal to 64 KB. 任何小于等于 64 KB 的事件均被视为一个计费事件。Any event that is less than or equal to 64 KB in size is considered to be one billable event. 如果该事件大于 64 KB,则根据事件大小按 64 KB 的倍数来计算计费事件的数量。If the event is greater than 64 KB, the number of billable events is calculated according to the event size, in multiples of 64 KB. 例如,发送到事件中心的 8-KB 事件按一个事件计费,而发送到事件中心的 96-KB 的消息则按两个事件计费。For example, an 8-KB event sent to the event hub is billed as one event, but a 96-KB message sent to the event hub is billed as two events.

从事件中心耗用的事件以及管理操作和控制调用(例如检查点)不计为计费入口事件,但会累计,其上限为吞吐量单位限额。Events consumed from an event hub, and management operations and control calls such as checkpoints, aren't counted as billable ingress events, but accrue up to the throughput unit allowance.

中转连接费用是否适用于事件中心?Do brokered connection charges apply to Event Hubs?

连接费用只在使用 AMQP 协议时适用。Connection charges apply only when the AMQP protocol is used. 使用 HTTP 发送事件没有连接费用,无论发送系统或设备的数量是多少。There are no connection charges for sending events using HTTP, regardless of the number of sending systems or devices. 如果计划使用 AMQP(例如,为了实现更高效的事件流式传输,或者为了对 IoT 命令和控制方案启用双向通信),请参阅事件中心定价信息页,了解有关每个服务层级中包括多少连接的详细信息。If you plan to use AMQP (for example, to achieve more efficient event streaming or to enable bi-directional communication in IoT command and control scenarios), see the Event Hubs pricing information page for details about how many connections are included in each service tier.

事件中心捕获如何计费?How is Event Hubs Capture billed?

命名空间中的任何事件中心启用了捕获选项时,即可启用捕获功能。Capture is enabled when any event hub in the namespace has the Capture option enabled. 事件中心捕获按所购买的吞吐量单位以小时计费。Event Hubs Capture is billed hourly per purchased throughput unit. 当吞吐量单位计数增加或减少时,事件中心捕获计费将在整个小时增量中反映这些变化。As the throughput unit count is increased or decreased, Event Hubs Capture billing reflects these changes in whole hour increments. 有关事件中心捕获计费的详细信息,请参阅事件中心定价信息For more information about Event Hubs Capture billing, see Event Hubs pricing information.

为事件中心捕获选择的存储帐户是否要付费?Do I get billed for the storage account I select for Event Hubs Capture?

捕获使用在事件中心启用捕获时提供的存储帐户。Capture uses a storage account you provide when enabled on an event hub. 因为这是你的存储帐户,任何针对此配置的费用更改都将计入你的 Azure 订阅。As it is your storage account, any changes for this configuration are billed to your Azure subscription.


是否有与事件中心关联的配额?Are there any quotas associated with Event Hubs?

如需所有事件中心配额的列表,请参阅配额For a list of all Event Hubs quotas, see quotas.


为什么在从其他订阅中删除命名空间后无法创建该命名空间?Why am I not able to create a namespace after deleting it from another subscription?

从订阅中删除命名空间时,请等待 4 个小时,然后才能在另一个订阅中使用相同的名称重新创建它。When you delete a namespace from a subscription, wait for 4 hours before recreating it with the same name in another subscription. 否则,可能会收到以下错误消息:Namespace already existsOtherwise, you may receive the following error message: Namespace already exists.

事件中心生成的异常有哪些,建议采取什么操作?What are some of the exceptions generated by Event Hubs and their suggested actions?

有关可能的事件中心异常的列表,请参阅异常概述For a list of possible Event Hubs exceptions, see Exceptions overview.

事件中心支持两种类型的诊断日志 - 捕获错误日志和操作日志 - 这两种日志都用 json 表示并可以通过 Azure 门户启用。Event Hubs supports two types of diagnostics logs - Capture error logs and operational logs - both of which are represented in json and can be turned on through the Azure portal.

支持和 SLASupport and SLA

事件中心的技术支持可通过 Azure 服务总线的 Microsoft 问答页面获取。Technical support for Event Hubs is available through the Microsoft Q&A question page for Azure Service Bus. 计费和订阅管理支持免费提供。Billing and subscription management support is provided at no cost.

若要详细了解我们的 SLA,请参阅服务级别协议页面。To learn more about our SLA, see the Service Level Agreements page.

Azure Stack HubAzure Stack Hub

当使用 Azure Blob 存储作为检查点存储时,我如何以特定版本的 Azure Storage SDK 为目标?How can I target a specific version of Azure Storage SDK when using Azure Blob Storage as a checkpoint store?

如果在 Azure Stack Hub 上运行此代码,除非将特定的存储 API 版本作为目标,否则会遇到运行时错误。If you run this code on Azure Stack Hub, you'll experience runtime errors unless you target a specific Storage API version. 这是因为事件中心 SDK 使用 Azure 中提供的最新 Azure 存储 API,而此 API 可能在 Azure Stack Hub 平台上不可用。That's because the Event Hubs SDK uses the latest available Azure Storage API available in Azure that may not be available on your Azure Stack Hub platform. Azure Stack Hub 支持的存储 Blob SDK 版本可能与 Azure 上通常提供的版本不同。Azure Stack Hub may support a different version of Storage Blob SDK than that are typically available on Azure. 如果你是将 Azure Blob 存储用作检查点存储,请检查支持用于 Azure Stack Hub 内部版本的 Azure 存储 API 版本,并在代码中将该版本作为目标。If you're using Azure Blog Storage as a checkpoint store, check the supported Azure Storage API version for your Azure Stack Hub build and target that version in your code.

例如,如果在 Azure Stack Hub 版本 2005 上运行,则存储服务的最高可用版本为版本 2019-02-02。For example, If you're running on Azure Stack Hub version 2005, the highest available version for the Storage service is version 2019-02-02. 默认情况下,事件中心 SDK 客户端库使用 Azure 上的最高可用版本(在 SDK 发布时为 2019-07-07)。By default, the Event Hubs SDK client library uses the highest available version on Azure (2019-07-07 at the time of the release of the SDK). 在这种情况下,除了执行本部分中的步骤以外,还需要添加相关代码,将存储服务 API 版本 2019-02-02 作为目标。In this case, besides following steps in this section, you'll also need to add code to target the Storage service API version 2019-02-02. 如需通过示例来了解如何以特定的存储 API 版本为目标,请参阅以下 C#、Java、Python 和 JavaScript/TypeScript 示例。For an example on how to target a specific Storage API version, see the following samples for C#, Java, Python, and JavaScript/TypeScript.

如需通过示例来了解如何从代码中以特定存储 API 版本为目标,请参阅 GitHub 上的以下示例:For an example on how to target a specific Storage API version from your code, see the following samples on GitHub:

后续步骤Next steps

访问以下链接可以了解有关事件中心的详细信息:You can learn more about Event Hubs by visiting the following links: