将 IoT 设备连接到 Azure:IoT 中心和事件中心Connecting IoT Devices to Azure: IoT Hub and Event Hubs

Azure 提供了专为各种类型的连接和通信开发的服务来帮助你将数据连接到云以利用其功能。Azure provides services specifically developed for diverse types of connectivity and communication to help you connect your data to the power of the cloud. Azure IoT 中心和 Azure 事件中心都是云服务,都可以引入大量的数据进行处理或存储,以便获取业务见解。Both Azure IoT Hub and Azure Event Hubs are cloud services that can ingest large amounts of data and process or store that data for business insights. 这两项服务的相似之处在于它们都支持以低延迟和高可靠性引入数据,但它们是为不同的用途设计的。The two services are similar in that they both support ingestion of data with low latency and high reliability, but they are designed for different purposes. IoT 中心是为解决将 IoT 设备连接到 Azure 云时的独特要求而开发的,而事件中心是为大数据流式处理而设计的。IoT Hub was developed to address the unique requirements of connecting IoT devices to the Azure cloud while Event Hubs was designed for big data streaming. Microsoft 建议使用 Azure IoT 中心将 IoT 设备连接到 AzureMicrosoft recommends using Azure IoT Hub to connect IoT devices to Azure

Azure IoT 中心是连接 IoT 设备的云网关,它会收集数据并促成业务见解和自动化。Azure IoT Hub is the cloud gateway that connects IoT devices to gather data and drive business insights and automation. 此外,IoT 中心还提供了用来丰富设备与后端系统之间关系的功能。In addition, IoT Hub includes features that enrich the relationship between your devices and your backend systems. 双向通信功能表示既可以从设备接收数据,也可以将命令和策略发回到设备。Bi-directional communication capabilities mean that while you receive data from devices you can also send commands and policies back to devices. 例如,使用云到设备的消息传送可以更新属性或调用设备管理操作。For example, use cloud-to-device messaging to update properties or invoke device management actions. 借助云到设备的通信,还可以使用 Azure IoT Edge 将云中情报发送到边缘设备。Cloud-to-device communication also enables you to send cloud intelligence to your edge devices with Azure IoT Edge. IoT 中心提供的唯一设备级标识有助于更好地保护 IoT 解决方案免受潜在攻击。The unique device-level identity provided by IoT Hub helps better secure your IoT solution from potential attacks.

Azure 事件中心是 Azure 的大数据流式处理服务。Azure Event Hubs is the big data streaming service of Azure. 它是为高吞吐量数据流式处理方案设计的,在这种场景中,客户每天可能会发送数十亿个请求。It is designed for high throughput data streaming scenarios where customers may send billions of requests per day. 事件中心使用分区的使用者模型来横向扩展流并且集成到 Azure 的大数据和分析服务中,这些服务包括 Databricks、流分析、ADLS 和 HDInsight。Event Hubs uses a partitioned consumer model to scale out your stream and is integrated into the big data and analytics services of Azure including Databricks, Stream Analytics, ADLS, and HDInsight. 此服务设计用来为大数据应用和解决方案提供支持,它提供事件中心捕获和自动扩张之类的功能。With features like Event Hubs Capture and Auto-Inflate, this service is designed to support your big data apps and solutions. 此外,IoT 中心还将事件中心用于其遥测数据流路径,因此,IoT 解决方案也会受益于事件中心的强大功能。Additionally, IoT Hub uses Event Hubs for its telemetry flow path, so your IoT solution also benefits from the tremendous power of Event Hubs.

概括而言,这两个解决方案都适合大规模的数据引入。To summarize, both solutions are designed for data ingestion at a massive scale. 仅凭 IoT 中心就能提供丰富的 IoT 特定功能,使客户在将 IoT 设备连接到 Azure 云后可以最大程度地提高企业价值。Only IoT Hub provides the rich IoT-specific capabilities that are designed for you to maximize the business value of connecting your IoT devices to the Azure cloud. 如果你的 IoT 之旅刚刚开始,请一开始就使用 IoT 中心来为数据引入方案提供支持,这将确保当业务和技术方面需要 IoT 功能时有完善的这类功能可供立即访问。If your IoT journey is just beginning, starting with IoT Hub to support your data ingestion scenarios will assure that you have instant access to the full-featured IoT capabilities once your business and technical needs require them.

下表详述了在针对 IoT 功能对 IoT 中心的两个层与事件中心进行评估时,二者的比较结果。The following table provides details about how the two tiers of IoT Hub compare to Event Hubs when you're evaluating them for IoT capabilities. 有关 IoT 中心的标准层和基本层的详细信息,请参阅如何选择合适的 IoT 中心层For more information about the standard and basic tiers of IoT Hub, see How to choose the right IoT Hub tier.

IoT 功能IoT Capability IoT 中心标准层IoT Hub standard tier IoT 中心基本层IoT Hub basic tier 事件中心Event Hubs
设备到云的消息传送Device-to-cloud messaging 勾选标记 勾选标记 勾选标记
协议:HTTPS、AMQP、基于 WebSocket 的 AMQPProtocols: HTTPS, AMQP, AMQP over webSockets 勾选标记 勾选标记 勾选标记
协议:MQTT、基于 WebSocket 的 MQTTProtocols: MQTT, MQTT over webSockets 勾选标记 勾选标记
每设备标识Per-device identity 勾选标记 勾选标记
从设备上传文件File upload from devices 勾选标记 勾选标记
设备预配服务Device Provisioning Service 勾选标记 勾选标记
云到设备的消息传送Cloud-to-device messaging 勾选标记
设备孪生和设备管理Device twin and device management 勾选标记
设备流(预览版)Device streams (preview) 勾选标记
IoT EdgeIoT Edge 勾选标记

即使唯一的用例是设备到云数据引入,我们也强烈建议使用 IoT 中心,因为它提供专用于 IoT 设备连接的服务。Even if the only use case is device-to-cloud data ingestion, we highly recommend using IoT Hub as it provides a service that is designed for IoT device connectivity.

后续步骤Next steps

若要进一步探索 IoT 中心的功能,请参阅 IoT 中心开发人员指南To further explore the capabilities of IoT Hub, see the IoT Hub developer guide.