{"id":20586,"date":"2024-03-29T04:03:12","date_gmt":"2024-03-29T11:03:12","guid":{"rendered":"https:\/\/tdengine.com\/?page_id=20586"},"modified":"2025-09-23T10:41:44","modified_gmt":"2025-09-23T17:41:44","slug":"mqtt","status":"publish","type":"page","link":"https:\/\/tdengine.com\/mqtt\/","title":{"rendered":"MQTT in TDengine"},"content":{"rendered":"\n<p>As adoption of <a href=\"https:\/\/tdengine.com\/what-is-the-industrial-iot\/\">Industrial IoT<\/a> (IIoT) technologies increases across manufacturing, energy, and other industries, it can become difficult to adapt traditional data protocols to the new use cases and requirements of the IIoT. For example, devices may be connected over wireless networks where connectivity cannot be guaranteed, and the scale of IIoT deployments may pose difficulties to client\/server architectures due to the volume of messages transmitted. In these scenarios, MQTT can be a suitable choice for ensuring communication between devices and the <a href=\"https:\/\/tdengine.com\/what-is-a-time-series-database\/\">time-series database<\/a> or other platform responsible for storing collected data.<\/p>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_81 counter-hierarchy ez-toc-counter ez-toc-custom ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #141414;color:#141414\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #141414;color:#141414\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/tdengine.com\/mqtt\/#What_Is_MQTT\" >What Is MQTT?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/tdengine.com\/mqtt\/#How_MQTT_Modernizes_Industrial_Data_Infrastructure\" >How MQTT Modernizes Industrial Data Infrastructure<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/tdengine.com\/mqtt\/#How_TDengine_Supports_MQTT\" >How TDengine Supports MQTT<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"gb-headline gb-headline-a111b2fb gb-headline-text\"><span class=\"ez-toc-section\" id=\"What_Is_MQTT\"><\/span>What Is MQTT?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p><a href=\"https:\/\/mqtt.org\/\" rel=\"noopener\">MQTT<\/a> is a lightweight messaging protocol developed to meet the needs of IoT applications &#8212; in particular, constrained devices and unreliable networks with low bandwidth and high latency. It facilitates communication between connected devices, sensors, and back-end systems in a reliable and efficient manner with a lower overhead compared with other protocols.<\/p>\n\n\n\n<p>A key feature of MQTT is its publish-subscribe (pub-sub) messaging pattern, in which clients called publishers publish messages to a central broker, and other clients called subscribers subscribe to specific topics to receive those messages. This model decouples data-generating devices from data-ingesting systems, enabling efficient and scalable communication without requiring a direct connection between them. Devices can publish or subscribe to topics without knowledge of other devices&#8217; network configurations, and a single message published on a topic can be received by multiple subscribers, enhancing the flexibility of the overall system while reducing network bandwidth consumption.<\/p>\n\n\n\n<p>MQTT was made public in 2010 with version 3.1 and became an OASIS standard with version 3.1.1 in 2014. The latest version, MQTT 5.0, was initially released in 2018 and greatly enhances the scalability of the protocol, ensuring that brokers can handle IIoT deployments of any size. In addition to standard MQTT, extensions such as <a href=\"https:\/\/sparkplug.eclipse.org\/\" rel=\"noopener\">Sparkplug<\/a> can further simplify and enhance IIoT systems.<\/p>\n\n\n\n<h2 class=\"gb-headline gb-headline-eb21db97 gb-headline-text\"><span class=\"ez-toc-section\" id=\"How_MQTT_Modernizes_Industrial_Data_Infrastructure\"><\/span>How MQTT Modernizes Industrial Data Infrastructure<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>At present, industrial data infrastructure often includes a wide variety of proprietary protocols, necessitating a data platform that can communicate with PLCs over many different interfaces. However, modern PLCs are quickly standardizing around open protocols such as MQTT and OPC UA, meaning that the PLC-to-historian data flow will be greatly simplified in greenfield deployments going forward. This will enable enterprises that select PLCs built for the IIoT to forgo traditional historians entirely and connect their MQTT brokers directly to a time-series database, greatly reducing their total cost of operation (TCO).<\/p>\n\n\n\n<p>In existing deployments, MQTT facilitates the integration of legacy industrial systems with modern IoT platforms, providing a pathway for the digital transformation of industrial operations. Its support for secure communication via TLS, along with various levels of quality of service (QoS), ensures that sensitive industrial data is transmitted securely and reliably. These characteristics allow for real-time monitoring and control of industrial processes and support advanced use cases such as predictive maintenance and analytics. By leveraging MQTT, industries can create more responsive, adaptive, and interconnected systems that can easily scale with the addition of new devices and technologies.<\/p>\n\n\n\n<h2 class=\"gb-headline gb-headline-f7dc088d gb-headline-text\"><span class=\"ez-toc-section\" id=\"How_TDengine_Supports_MQTT\"><\/span>How TDengine Supports MQTT<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>TDengine TSDB can ingest and store data from multiple MQTT sources as well as other modern protocols like OPC and traditional historians such as <a href=\"https:\/\/tdengine.com\/pi-system\/\">PI System<\/a> and <a href=\"https:\/\/tdengine.com\/wonderware\/\">Wonderware<\/a>. A major advantage of using TDengine TSDB as a unified platform for MQTT data is that ETL can be performed on the platform side for multiple brokers and sites. This ensures good data governance even when different systems are in use, centralizing all data with its full context in TDengine TSDB. Analytics, visualization, and other tools can then be integrated with TDengine TSDB and work with data from all systems without conflicts, convoluted filtering, or manual workloads.<\/p>\n\n\n\n<img decoding=\"async\" width=\"5210\" height=\"2771\" class=\"gb-media-620cef37\" src=\"https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/mqtt-0924.png?strip=all&sharp=1\" alt=\"\" srcset=\"https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/mqtt-0924.png?strip=all&amp;sharp=1 5210w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/mqtt-0924-300x160.png?strip=all&amp;sharp=1 300w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/mqtt-0924-1024x545.png?strip=all&amp;sharp=1 1024w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/mqtt-0924-768x408.png?strip=all&amp;sharp=1 768w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/mqtt-0924-1536x817.png?strip=all&amp;sharp=1 1536w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/mqtt-0924-2048x1089.png?strip=all&amp;sharp=1 2048w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/mqtt-0924.png?strip=all&amp;sharp=1&amp;w=3126 3126w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/mqtt-0924.png?strip=all&amp;sharp=1&amp;w=4168 4168w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/mqtt-0924.png?strip=all&amp;sharp=1&amp;w=450 450w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/mqtt-0924.png?strip=all&amp;sharp=1&amp;w=1920 1920w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" \/>\n\n\n\n<p>TDengine TSDB provides a zero-code data connector for MQTT at no extra cost. The connector enables real-time ingestion of data from MQTT 3.1, 3.11, and 5.0 sources into the unified TDengine platform. To begin ingesting MQTT data, create a database in TDengine TSDB to store the data, configure the MQTT server endpoint, and specify a QoS configuration for your topics.<\/p>\n\n\n\n<figure class=\"gb-block-image gb-block-image-b48ead62\"><img decoding=\"async\" width=\"1096\" height=\"666\" class=\"gb-image gb-image-b48ead62\" src=\"https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/mqtt-cloud.png?strip=all&sharp=1\" alt=\"\" title=\"mqtt-cloud\" srcset=\"https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/mqtt-cloud.png?strip=all&amp;sharp=1 1096w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/mqtt-cloud-300x182.png?strip=all&amp;sharp=1 300w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/mqtt-cloud-1024x622.png?strip=all&amp;sharp=1 1024w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/mqtt-cloud-768x467.png?strip=all&amp;sharp=1 768w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/mqtt-cloud.png?strip=all&amp;sharp=1&amp;w=219 219w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/mqtt-cloud.png?strip=all&amp;sharp=1&amp;w=438 438w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/mqtt-cloud.png?strip=all&amp;sharp=1&amp;w=657 657w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/mqtt-cloud.png?strip=all&amp;sharp=1&amp;w=876 876w\" sizes=\"(max-width: 1096px) 100vw, 1096px\" \/><\/figure>\n\n\n\n<p>After connecting to the MQTT broker, you can upload a sample of your MQTT data into the <strong>MQTT Payload<\/strong> field and begin the extract, transform, and load (ETL) process.<\/p>\n\n\n\n<ol start=\"1\" class=\"wp-block-list\">\n<li><strong>Parse:<\/strong> You use JSON or a regular expression (regex) to specify the MQTT data that you want to ingest. For example, the expression <code class=\"\" data-line=\"\">(?&lt;y&gt;[0-9]{4})-(?&lt;m&gt;[0-9]{2})-(?&lt;d&gt;[0-9]{2})<\/code> ingests timestamp data in YYYY-MM-DD format.<\/li>\n\n\n\n<li><strong>Extract:<\/strong> You can select <strong>Split<\/strong> to extract multiple columns from your data using a delimiter. For example, if you have hierarchical data such as <code class=\"\" data-line=\"\">California.LosAngeles<\/code>, you can specify a period (.) as the delimiter and <code class=\"\" data-line=\"\">2<\/code> as the number of columns to extract this data into separate state (<code class=\"\" data-line=\"\">California<\/code>) and city (<code class=\"\" data-line=\"\">LosAngeles<\/code>) columns. For more complex extraction, select <strong>Regex<\/strong> and input a regular expression.<\/li>\n\n\n\n<li><strong>Filter:<\/strong> You can filter out data based on user-specified conditions. Only data that meets the conditions is ingested into TDengine TSDB. For example, you can input <code class=\"\" data-line=\"\">voltage &gt; 220<\/code> to ingest only data whose voltage is greater than 220. In addition to comparisons, Boolean and string conditions are also supported.<\/li>\n\n\n\n<li><strong>Transform:<\/strong> You can transform your data into each column of the specified supertable. For example, select <strong>Mapping<\/strong> and the name of the desired column to map a key in your MQTT data to a column in TDengine TSDB. Note that key names that match existing column names are mapped automatically. Other transformation options include value, generator, join, format, sum, and expression.<\/li>\n<\/ol>\n\n\n\n<p>After you have configured ETL for your data, click <strong>Add<\/strong>, and TDengine TSDB will begin ingesting data according to your specifications. For detailed instructions on setting up MQTT as a data source, see the <a href=\"https:\/\/docs.tdengine.com\/cloud\/data-in\/ds\/mqtt\/\">official documentation<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>As adoption of Industrial IoT (IIoT) technologies increases across manufacturing, energy, and other industries, it can become difficult to adapt traditional data protocols to the new use cases and requirements of the IIoT. For example, devices may be connected over wireless networks where connectivity cannot be guaranteed, and the scale of IIoT deployments may pose &#8230; <a title=\"MQTT in TDengine\" class=\"read-more\" href=\"https:\/\/tdengine.com\/mqtt\/\" aria-label=\"Read more about MQTT in TDengine\">Read more<\/a><\/p>\n","protected":false},"author":102,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"content-type":"","footnotes":""},"categories":[272],"tags":[],"ppma_author":[181],"class_list":{"0":"post-20586","1":"page","2":"type-page","3":"status-publish","5":"category-sp"},"_links":{"self":[{"href":"https:\/\/tdengine.com\/wp-json\/wp\/v2\/pages\/20586","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tdengine.com\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/tdengine.com\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/tdengine.com\/wp-json\/wp\/v2\/users\/102"}],"replies":[{"embeddable":true,"href":"https:\/\/tdengine.com\/wp-json\/wp\/v2\/comments?post=20586"}],"version-history":[{"count":16,"href":"https:\/\/tdengine.com\/wp-json\/wp\/v2\/pages\/20586\/revisions"}],"predecessor-version":[{"id":28950,"href":"https:\/\/tdengine.com\/wp-json\/wp\/v2\/pages\/20586\/revisions\/28950"}],"wp:attachment":[{"href":"https:\/\/tdengine.com\/wp-json\/wp\/v2\/media?parent=20586"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tdengine.com\/wp-json\/wp\/v2\/categories?post=20586"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tdengine.com\/wp-json\/wp\/v2\/tags?post=20586"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/tdengine.com\/wp-json\/wp\/v2\/ppma_author?post=20586"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}