{"id":127,"date":"2021-10-26T18:35:53","date_gmt":"2021-10-26T10:35:53","guid":{"rendered":"https:\/\/www.osvlabs.com\/blog\/?p=127"},"modified":"2021-10-27T10:10:00","modified_gmt":"2021-10-27T02:10:00","slug":"thingsboard-iot-gateway%e6%98%af%e4%bb%80%e4%b9%88","status":"publish","type":"post","link":"https:\/\/blog.osvlabs.com\/?p=127","title":{"rendered":"ThingsBoard IoT Gateway\u662f\u4ec0\u4e48"},"content":{"rendered":"<p>\u6587\u6863\u65e5\u671f\uff1a2021\/10\/25<br \/>\n\u4f5c\u8005\uff1a\u6817\u6d69<\/p>\n<hr \/>\n<h2>1. ThingsBoard IoT Gateway\u6838\u5fc3\u6982\u5ff5<\/h2>\n<p>ThingsBoard IoT Gateway\u662f\u4e00\u4e2a\u7531ThingsBoard\u5b98\u65b9\u539f\u521b\u4e14<strong>\u5f00\u6e90<\/strong>\u7684\u7269\u8054\u7f51<strong>\u8f6f\u7f51\u5173<\/strong>\uff0c<strong>\u4f7f\u7528\u4e14\u4ec5\u4f7f\u7528MQTT\u534f\u8bae<\/strong>\u4e0eTB\u5e73\u53f0\uff08ThingsBoard IoT Platform\uff09\u8fdb\u884c\u901a\u8baf\uff0c\u4e3aTB\u5e73\u53f0\u63d0\u4f9b<strong>\u652f\u6301\u66f4\u591a\u534f\u8bae\u7684\u6570\u636e\u6536\u96c6<\/strong>\u529f\u80fd\u548c\u53ef\u80fd\u7684\u8bbe\u5907\u7ba1\u7406\u529f\u80fd\uff0c<strong>\u5141\u8bb8\u5404\u7c7b\u8bbe\u5907\u63d0\u4ea4\u6570\u636e<\/strong>\u81f3TB\u5e73\u53f0\u3002<\/p>\n<hr \/>\n<h2>2. ThingsBoard\u5b98\u65b9\u5bf9Gateway\u7684\u8bf4\u660e<\/h2>\n<h3>2.1 \u4ec0\u4e48\u662fThingsBoard IoT Gateway<\/h3>\n<p>Thingsboard IoT Gateway\u662f\u4e00\u4e2a\u5f00\u6e90\u7684\u89e3\u51b3\u65b9\u6848\uff0c\u5b83\u5141\u8bb8\u4f60\u5c06\u8fde\u63a5\u5230\u4f20\u7edf\u7cfb\u7edf\u548c\u7b2c\u4e09\u65b9\u7cfb\u7edf\u7684\u8bbe\u5907\u4e0eThingsboard\u96c6\u6210\u3002<\/p>\n<p>Thingsboard\u662f\u4e00\u4e2a\u5f00\u6e90\u7684\u7269\u8054\u7f51\u5e73\u53f0\uff0c\u7528\u4e8e\u6570\u636e\u6536\u96c6\u3001\u5904\u7406\u3001\u53ef\u89c6\u5316\u548c\u8bbe\u5907\u7ba1\u7406\u3002\u5982\u679c\u4f60\u662f\u65b0\u7684\u5e73\u53f0\u7528\u6237\uff0c\u8bf7\u53c2\u9605<a href=\"https:\/\/thingsboard.io\/docs\/getting-started-guides\/what-is-thingsboard\/\">\u4ec0\u4e48\u662fThingsboard\uff1f<\/a><\/p>\n<p>TB\u5b98\u65b9\u5e38\u7528&quot;Thingsboard&quot;\u6307\u4ee3TB\u5e73\u53f0\uff08&quot;Thingsboard IoT Platform&quot;\uff09\uff0c\u867d\u7136\u81ea\u79f0\u5f00\u6e90\uff0c\u4f46\u90e8\u5206\u91cd\u8981\u529f\u80fd\u5e76\u4e0d\u5f00\u6e90<\/p>\n<h3>2.2 ThingsBoard\u7269\u8054\u7f51\u7f51\u5173\u63d0\u4f9b\u4ee5\u4e0b\u529f\u80fd\uff1a<\/h3>\n<ul>\n<li><strong>MQTT\u8fde\u63a5\u5668<\/strong>\uff1a\u7528\u4e8e\u63a7\u5236\u3001\u914d\u7f6e\u548c\u6536\u96c6\u6765\u81ea\u4f7f\u7528\u73b0\u6709\u534f\u8bae\u8fde\u63a5\u5230<strong>\u5916\u90e8MQTT Broker<\/strong>\u7684\u7269\u8054\u7f51\u8bbe\u5907\u7684\u6570\u636e\u3002<\/li>\n<li><strong>OPC-UA\u8fde\u63a5\u5668<\/strong>\uff1a\u4ece\u8fde\u63a5\u5230<strong>OPC-UA\u670d\u52a1\u5668<\/strong>\u7684\u7269\u8054\u7f51\u8bbe\u5907\u6536\u96c6\u6570\u636e\u3002<\/li>\n<li><strong>Modbus\u8fde\u63a5\u5668<\/strong>\uff1a\u4ece\u901a\u8fc7Modbus\u534f\u8bae\u8fde\u63a5\u7684\u7269\u8054\u7f51\u8bbe\u5907\u4e2d\u6536\u96c6\u6570\u636e\u3002<\/li>\n<li><strong>BLE\u8fde\u63a5\u5668<\/strong>\uff1a\u4ece\u4f7f\u7528<strong>Bluetooth Low Energy<\/strong>\u534f\u8bae\u8fde\u63a5\u7684\u7269\u8054\u7f51\u8bbe\u5907\u4e2d\u6536\u96c6\u6570\u636e\u3002<\/li>\n<li><strong>Request\u8fde\u63a5\u5668<\/strong>\uff1a<strong>\u4ece\u5177\u6709HTTP(S)API\u7aef\u70b9<\/strong>\u7684\u7269\u8054\u7f51\u8bbe\u5907\u4e2d\u6536\u96c6\u6570\u636e\u3002<\/li>\n<li><strong>CAN\u8fde\u63a5\u5668<\/strong>\uff1a\u4ece\u901a\u8fc7CAN\u534f\u8bae\u8fde\u63a5\u7684\u7269\u8054\u7f51\u8bbe\u5907\u4e2d\u6536\u96c6\u6570\u636e\u3002<\/li>\n<li><strong>BACnet\u8fde\u63a5\u5668<\/strong>\uff1a\u4ece\u901a\u8fc7BACnet\u534f\u8bae\u8fde\u63a5\u7684\u7269\u8054\u7f51\u8bbe\u5907\u4e2d\u6536\u96c6\u6570\u636e\u3002<\/li>\n<li><strong>ODBC\u8fde\u63a5\u5668<\/strong>\uff1a\u4ece<strong>ODBC\u6570\u636e\u5e93<\/strong>\u6536\u96c6\u6570\u636e\u3002<\/li>\n<li><strong>REST\u8fde\u63a5\u5668<\/strong>\uff1a\u521b\u5efa\u7aef\u70b9\u5e76<strong>\u4ece\u4f20\u5165\u7684HTTP\u8bf7\u6c42<\/strong>\u4e2d\u6536\u96c6\u6570\u636e\u3002<\/li>\n<li><strong>SNMP\u8fde\u63a5\u5668<\/strong>\uff1a\u4ece<strong>SNMP\u7ba1\u7406\u5668<\/strong>\u6536\u96c6\u6570\u636e\u3002<\/li>\n<li><strong>FTP\u8fde\u63a5\u5668<\/strong>\uff1a\u4ece<strong>FTP\u670d\u52a1\u5668<\/strong>\u6536\u96c6\u6570\u636e<\/li>\n<li><strong>\u81ea\u5b9a\u4e49\u8fde\u63a5\u5668<\/strong>\uff1a\u4ece\u901a\u8fc7\u4e0d\u540c\u534f\u8bae\u8fde\u63a5\u7684\u7269\u8054\u7f51\u8bbe\u5907 [^\u4ece\u901a\u8fc7\u4e0d\u540c\u534f\u8bae\u8fde\u63a5\u7684\u7269\u8054\u7f51\u8bbe\u5907]\u6536\u96c6\u6570\u636e\u3002(\u4f60\u53ef\u4ee5\u4e3a\u9700\u8981\u7684\u534f\u8bae\u521b\u5efa\u4f60\u81ea\u5df1\u7684\u8fde\u63a5\u5668\uff09\u3002<\/li>\n<li><strong>\u6301\u4e45\u6536\u96c6\u6570\u636e<\/strong>\uff1a\u4fdd\u8bc1\u5728\u7f51\u7edc\u6216\u786c\u4ef6\u6545\u969c\u7684\u60c5\u51b5\u4e0b\u7684\u6570\u636e\u4ea4\u4ed8\u3002<\/li>\n<li><strong>\u81ea\u52a8\u91cd\u65b0\u8fde\u63a5<\/strong>\u5230ThingsBoard\u96c6\u7fa4\u3002<\/li>\n<li>\u5c06\u4f20\u5165\u7684\u6570\u636e\u548c\u6d88\u606f<strong>\u6620\u5c04<\/strong>\u5230<strong>\u7edf\u4e00\u683c\u5f0f<\/strong>\uff0c\u7b80\u5355\u800c\u5f3a\u5927\u3002<br \/>\n\u4ece\u901a\u8fc7\u4e0d\u540c\u534f\u8bae\u8fde\u63a5\u7684\u7269\u8054\u7f51\u8bbe\u5907: \u9ed8\u8ba4\u7684\u81ea\u5b9a\u4e49\u8fde\u63a5\u5668\u4ec5\u652f\u6301\u4e32\u53e3\uff08Serial\uff09\u901a\u4fe1\uff0c\u4e0d\u7b26\u5408\u5b9e\u9645\u9700\u8981\u3002<\/li>\n<\/ul>\n<h3>2.3 TB\u5b98\u5ba3\u67b6\u6784<\/h3>\n<h4>2.3.1 \u7f51\u5173\u67b6\u6784\u56fe<\/h4>\n<p>\u5173\u4e8e\u7f51\u5173\u5b98\u65b9\u67b6\u6784\u56fe: \u5b98\u65b9\u7684\u67b6\u6784\u56fe\u6709\u8bf8\u591a\u7ec6\u8282\u4e0e\u5b9e\u9645\u4e0d\u7b26,\u6df1\u5165\u4e86\u89e3\u65f6\u8bf7\u53c2\u8003\u672c\u6587\u4e2d\u7684\u300a\u5b9e\u9645\u300b \u3002<br \/>\n<a href=\"https:\/\/blog.osvlabs.com\/wp-content\/uploads\/2021\/10\/gateway_arch_official.svg\"><img src=\"https:\/\/blog.osvlabs.com\/wp-content\/uploads\/2021\/10\/gateway_arch_official.svg\" alt=\"\" \/><\/a><\/p>\n<h4>2.3.2 \u5e73\u53f0\u67b6\u6784\u56fe<\/h4>\n<p><a href=\"https:\/\/blog.osvlabs.com\/wp-content\/uploads\/2021\/10\/thingsboard-architecture.svg\"><img src=\"https:\/\/blog.osvlabs.com\/wp-content\/uploads\/2021\/10\/thingsboard-architecture.svg\" alt=\"\" \/><\/a><\/p>\n<p>\u5bf9\u5e73\u53f0\u67b6\u6784\u56fe\u7684\u89e3\u8bfb\uff1a<\/p>\n<ul>\n<li><strong>\u8bbe\u5907\/\u6570\u636e\u6e90<\/strong> \u4e0d\u901a\u8fc7TB\u7f51\u5173\uff0c<strong>\u4e0eTB\u5e73\u53f0\u76f4\u63a5\u8fde\u63a5<\/strong>\u662f\u53ef\u80fd\u7684<\/li>\n<li><strong>TB\u5e73\u53f0\u4ec5\u652f\u6301\u90e8\u5206\u534f\u8bae<\/strong>\u7684\u901a\u8baf\uff0c\u5982\u679c \u8bbe\u5907\/\u6570\u636e\u6e90 \u9700\u8981\u901a\u8fc7\u5176\u5b83\u534f\u8bae\u4e0e\u5e73\u53f0\u76f8\u8fde\uff0c\u6b64\u65f6\u9700\u8981TB\u7f51\u5173<\/li>\n<li>TB\u5b98\u65b9\u5bf9\u5176\u7f51\u5173\u7684\u89e3\u91ca\u4e3a&quot;<strong>\u652f\u6301Modbus\u3001OPC-UA\u3001BLE\u3001CAN\u3001MQTT\u3001HTTP\u548c\u5176\u5b83\u534f\u8bae<\/strong>&quot;<\/li>\n<li>TB\u5e73\u53f0\u652f\u6301\u5916\u90e8\u7cfb\u7edf\u4ee5<strong>REST API<\/strong>\u6216<strong>WebSockets<\/strong>\u7684\u65b9\u5f0f\u4e0eTB\u5e73\u53f0\u4ea4\u4e92<\/li>\n<li>TB\u5e73\u53f0\u652f\u6301\u5916\u90e8\u7cfb\u7edf\u4ee5TB\u5e73\u53f0\u4e2d\u7684<strong>\u89c4\u5219\u5f15\u64ce<\/strong>\uff08Rule Engine, \u6709\u65f6\u4e5f\u88ab\u5f00\u53d1\u4eba\u5458\u7528Rule Chain\uff08<strong>\u89c4\u5219\u94fe<\/strong>\uff09\u6307\u4ee3\uff09\u7684\u65b9\u5f0f\u4e0eTB\u5e73\u53f0\u4ea4\u4e92<\/li>\n<li>\u6574\u4e2a\u67b6\u6784\u4e2d\uff0c\u6570\u636e\u7684\u957f\u671f\u6301\u4e45\u5316\u5b58\u50a8\u53d1\u751f\u5728TB\u5e73\u53f0\u7684\u6570\u636e\u5e93\u5185\u3002TB\u5e73\u53f0\u4f7f\u7528\u7684\u6570\u636e\u5e93\u4e3a<strong>PostgreSQL<\/strong>\u548c<strong>Timescale\u6216Cassandra<\/strong><\/li>\n<\/ul>\n<h4>2.3.3 \u67b6\u6784<\/h4>\n<p>\u7269\u8054\u7f51\u7f51\u5173\u662f\u4e00\u4e2a<strong>\u8f6f\u4ef6<\/strong>\u7ec4\u4ef6\uff0c\u65e8\u5728\u8fd0\u884c\u5728\u652f\u6301<strong>Python 3.5\u4ee5\u4e0a<\/strong>\u7684\u57fa\u4e8eLinux\u7684\u5fae\u578b\u8ba1\u7b97\u673a\u4e0a [\u57fa\u4e8eLinux\u7684\u5fae\u578b\u8ba1\u7b97\u673a\u4e0a]\u3002ThingsBoard\u7269\u8054\u7f51\u7f51\u5173\u7684\u4e3b\u8981\u7ec4\u4ef6\u5982\u4e0a\u6240\u793a\u3002<\/p>\n<p>\u57fa\u4e8eLinux\u7684\u5fae\u578b\u8ba1\u7b97\u673a\u4e0a: \u5e76\u4e0d\u662f\u4ec5\u57fa\u4e8eLinux\u3002\u7531\u4e8ePython\u8fd9\u4e00\u7f16\u7a0b\u8bed\u8a00\u7684\u7279\u6027\uff0c\u6211\u4eec\u65e2\u53ef\u4ee5\u5728\u5404\u64cd\u4f5c\u7cfb\u7edf\u4e0a\u76f4\u63a5\u4f7f\u7528Python\u8fd0\u884c\u7f51\u5173\u4ee3\u7801\uff0c\u4e5f\u53ef\u4ee5\u5728\u5404\u64cd\u4f5c\u7cfb\u7edf\u4e2d\u8fd0\u884c\u88ab\u6253\u5305\u6210\u5bb9\u5668\u7684\u7f51\u5173\u3002<\/p>\n<h4>2.3.4 \u8fde\u63a5\u5668<\/h4>\n<p>\u8be5\u7ec4\u4ef6\u7684\u76ee\u7684\u662f\u8fde\u63a5\u5230<strong>\u5916\u90e8\u7cfb\u7edf<\/strong>\uff08\u5982MQTT\u4ee3\u7406\u6216OPC-UA\u670d\u52a1\u5668\uff09\u6216\u76f4\u63a5\u8fde\u63a5\u5230<strong>\u8bbe\u5907<\/strong>\uff08\u5982Modbus\u3001BLE\u6216CAN\uff09\u3002\u4e00\u65e6\u8fde\u63a5\uff0c\u8fde\u63a5\u5668\u8981\u4e48\u4ece\u8fd9\u4e9b\u7cfb\u7edf\u4e2d\u8f6e\u8be2\u6570\u636e\uff0c\u8981\u4e48\u8ba2\u9605\u66f4\u65b0\u3002\u8f6e\u8be2\u4e0e\u8ba2\u9605\u53d6\u51b3\u4e8e\u534f\u8bae\u7684\u80fd\u529b\u3002\u4f8b\u5982\uff0c\u6211\u4eec\u5bf9MQTT\u8fde\u63a5\u5668\u4f7f\u7528\u8ba2\u9605\u6a21\u5f0f\uff0c\u5bf9Modbus\u548cCAN\u4f7f\u7528\u8f6e\u8be2\u3002\u8fde\u63a5\u5668\u4e5f\u80fd\u591f\u76f4\u63a5\u6216\u901a\u8fc7\u5916\u90e8\u7cfb\u7edf [\u76f4\u63a5\u6216\u901a\u8fc7\u5916\u90e8\u7cfb\u7edf]\u5411\u8bbe\u5907\u63a8\u9001\u66f4\u65b0\u3002<br \/>\n\u76f4\u63a5\u6216\u901a\u8fc7\u5916\u90e8\u7cfb\u7edf: \u53d6\u51b3\u4e8e\u534f\u8bae\u3001\u7f51\u5173\u8fde\u63a5\u5668\u7684\u5b9e\u73b0\u3001\u5bf9\u5e94\u534f\u8bae\u7684\u8bbe\u5907\u672c\u8eab\u662f\u5426\u652f\u6301\u8fd9\u4e48\u505a\u3002<\/p>\n<p>\u53ef\u4ee5\u4f7f\u7528<a href=\"https:\/\/thingsboard.io\/docs\/iot-gateway\/custom\/\">\u5b9a\u5236\u6307\u5357<\/a> \u6765\u5b9a\u4e49\u4f60\u81ea\u5df1\u7684\u8fde\u63a5\u5668\u3002<br \/>\n\u6240\u8c13\u7684\u300a\u5b9a\u5236\u6307\u5357\u300b\u5e76\u4e0d\u597d\u7528\uff0c\u8fc7\u91cf\u7684\u7ec6\u8282\u5e76\u672a\u88ab\u89e3\u91ca\u4e14\u4e0e\u5b9e\u9645\u53ef\u80fd\u4e0d\u7b26<\/p>\n<h4>2.3.5 \u8f6c\u6362\u5668<\/h4>\n<p>\u8f6c\u6362\u5668\u8d1f\u8d23\u5c06\u6570\u636e\u4ece\u7279\u5b9a\u534f\u8bae\u683c\u5f0f\u8f6c\u6362\u4e3a<strong>ThingsBoard\u683c\u5f0f<\/strong>\u3002<strong>\u8f6c\u6362\u5668\u662f\u7531\u8fde\u63a5\u5668\u8c03\u7528\u7684<\/strong>\u3002\u8f6c\u6362\u5668\u901a\u5e38\u662f\u9488\u5bf9\u8fde\u63a5\u5668\u652f\u6301\u7684\u534f\u8bae\uff0c\u6709\u4e0a\u884c\u94fe\u8def\u548c\u4e0b\u884c\u94fe\u8def[^\u4e0a\u884c\u94fe\u8def\u548c\u4e0b\u884c\u94fe\u8def]\u8f6c\u6362\u5668\u3002\u4e0a\u884c\u94fe\u8def\u8f6c\u6362\u5668\u7528\u4e8e\u5c06\u6570\u636e\u4ece\u7279\u5b9a\u534f\u8bae\u8f6c\u6362\u4e3aThingsBoard\u683c\u5f0f\u3002\u4e0b\u884c\u94fe\u8def\u8f6c\u6362\u5668\u7528\u4e8e\u5c06\u4fe1\u606f\u4eceThingsBoard\u683c\u5f0f\u8f6c\u6362\u4e3a\u7279\u5b9a\u7684\u534f\u8bae\u683c\u5f0f\u3002<br \/>\n\u4e0a\u884c\u94fe\u8def\u548c\u4e0b\u884c\u94fe\u8def: \u5404\u534f\u8bae\u7684\u8f6c\u6362\u5668\u4e0d\u4e00\u5b9a\u540c\u65f6\u5177\u5907\u4e0a\u884c\u94fe\u8def\u8f6c\u6362\u5668\u548c\u4e0b\u884c\u94fe\u8def\u8f6c\u6362\u5668\u3002<\/p>\n<p>\u53ef\u4ee5\u4f7f\u7528<a href=\"https:\/\/thingsboard.io\/docs\/iot-gateway\/custom\/\">\u5b9a\u5236\u6307\u5357<\/a> \u5b9a\u4e49\u81ea\u5df1\u7684\u8f6c\u6362\u5668\u3002<\/p>\n<h4>2.3.6 \u4e8b\u4ef6\u5b58\u50a8<\/h4>\n<p>\u4e8b\u4ef6\u5b58\u50a8\u7528\u4e8e<strong>\u4e34\u65f6\u5b58\u50a8<\/strong>\u7531\u8fde\u63a5\u5668\u4ea7\u751f\u7684\u9065\u6d4b\u548c\u5176\u4ed6\u4e8b\u4ef6\uff0c\u76f4\u5230\u5b83\u4eec\u88ab\u4f20\u9012\u5230 ThingsBoard\u3002\u4e8b\u4ef6\u5b58\u50a8\u652f\u6301\u4e24\u79cd\u5b9e\u73b0\u65b9\u5f0f\uff1a<strong>\u5185\u5b58<\/strong>\u961f\u5217\u548c\u6301\u4e45\u6027<strong>\u6587\u4ef6<\/strong>\u5b58\u50a8\u3002\u8fd9\u4e24\u79cd\u5b9e\u73b0\u65b9\u5f0f\u90fd\u80fd\u786e\u4fdd\u5728\u7f51\u7edc\u4e2d\u65ad\u7684\u60c5\u51b5\u4e0b\uff0c\u4f60\u7684\u8bbe\u5907\u6570\u636e\u6700\u7ec8\u80fd\u5f97\u5230\u4f20\u9012\u3002<strong>\u5185\u5b58\u961f\u5217\u6700\u5927\u9650\u5ea6\u5730\u51cf\u5c11\u4e86IO\u64cd\u4f5c\uff0c\u4f46\u5728\u7f51\u5173\u8fdb\u7a0b\u91cd\u65b0\u542f\u52a8\u7684\u60c5\u51b5\u4e0b\u53ef\u80fd\u4f1a\u4e22\u5931\u4fe1\u606f<\/strong>\u3002<br \/>\n<strong>\u6301\u4e45\u6027\u6587\u4ef6\u5b58\u50a8\u5728\u8fdb\u7a0b\u91cd\u542f\u540e\u4ecd\u7136\u5b58\u5728\uff0c\u4f46\u4f1a\u5bf9\u6587\u4ef6\u7cfb\u7edf\u6267\u884cIO\u64cd\u4f5c<\/strong>\u3002<\/p>\n<h4>2.3.7 ThingsBoard\u5ba2\u6237\u7aef<\/h4>\n<p><strong>\u7f51\u5173\u901a\u8fc7MQTT\u534f\u8bae\u4e0eThingsBoard\u8fdb\u884c\u901a\u4fe1<\/strong>\uff0c\u5e76\u4f7f\u7528<a href=\"https:\/\/thingsboard.io\/docs\/reference\/gateway-mqtt-api\/\">\u8fd9\u91cc<\/a>\u63cf\u8ff0\u7684API\u3002ThingsBoard\u5ba2\u6237\u7aef\u662f\u4e00\u4e2a\u72ec\u7acb\u7684\u7ebf\u7a0b\uff0c\u4e00\u65e6\u4e0eThingsBoard\u7684\u8fde\u63a5\u5904\u4e8e\u6d3b\u52a8\u72b6\u6001\uff0c\u5b83\u5c31\u4f1a\u8f6e\u8be2\u4e8b\u4ef6\u5b58\u50a8\u5e76\u4f20\u9012\u6d88\u606f\u3002<br \/>\nThingsBoard\u5ba2\u6237\u7aef\u652f\u6301\u5bf9\u8fde\u63a5\u7684\u76d1\u63a7\uff0c\u4e3a\u63d0\u9ad8\u6027\u80fd\u800c\u5bf9\u4e8b\u4ef6\u8fdb\u884c\u6279\u5904\u7406\u4ee5\u53ca\u8bb8\u591a\u5176\u4ed6\u529f\u80fd\u3002<\/p>\n<h4>2.3.8 \u7f51\u5173\u670d\u52a1<\/h4>\n<p>\u7f51\u5173\u670d\u52a1\u8d1f\u8d23\u8fde\u63a5\u5668\u3001\u4e8b\u4ef6\u5b58\u50a8\u548cThingsBoard\u5ba2\u6237\u7aef\u7684\u542f\u52a8\u3002\u8be5\u670d\u52a1\u6536\u96c6\u5e76<strong>\u5b9a\u671f\u5411ThingsBoard\u62a5\u544a\u6709\u5173\u4f20\u5165\u4fe1\u606f\u548c\u8fde\u63a5\u8bbe\u5907\u7684\u7edf\u8ba1\u6570\u636e<\/strong>\u3002\u7f51\u5173\u670d\u52a1\u4fdd\u5b58<strong>\u8fde\u63a5\u8bbe\u5907\u7684\u5217\u8868<\/strong>\uff0c\u4ee5\u4fbf\u5728\u7f51\u5173\u91cd\u65b0\u542f\u52a8\u7684\u60c5\u51b5\u4e0b\u80fd\u591f\u91cd\u65b0\u8ba2\u9605\u8bbe\u5907\u914d\u7f6e\u66f4\u65b0\u3002<\/p>\n<hr \/>\n<h2>3. \u5b9e\u9645<\/h2>\n<p>\u5b98\u65b9\u7684\u67b6\u6784\u56fe\u6709\u8bf8\u591a\u7ec6\u8282\u672a\u88ab\u63d0\u5230\u751a\u81f3\u4e0e\u5b9e\u9645\u4e0d\u7b26\uff0c\u7ecf\u5e38\u5bfc\u81f4\u4eba\u5728\u9605\u8bfb\u65f6\u53d1\u751f\u7406\u89e3\u9519\u8bef\u751a\u81f3\u88ab\u8bef\u5bfc\u3002\u5bf9\u4e8e\u8fd9\u4e9b\u7ec6\u8282\uff0c\u4ee5\u4e0b\u662f\u66f4\u771f\u5b9e\u4e5f\u66f4\u5b9e\u9645\u7684\u7f51\u5173\u67b6\u6784\u56fe\uff1a<\/p>\n<p><a href=\"https:\/\/blog.osvlabs.com\/wp-content\/uploads\/2021\/10\/gateway_arch_real.png\"><img src=\"https:\/\/blog.osvlabs.com\/wp-content\/uploads\/2021\/10\/gateway_arch_real.png\" alt=\"\" \/><\/a><\/p>\n<p>\u5173\u4e8e\u8fd9\u4e9b&quot;\u7ec6\u8282&quot;\uff1a<\/p>\n<ul>\n<li>TB\u7f51\u5173\u4e2d\u7684<strong>\u6301\u4e45\u6027\u5b58\u50a8\uff08Persistent Storage\uff09\u7684\u6570\u636e\u6765\u6e90\u4e3a\u5404\u8fde\u63a5\u5668\u5bf9\u7f51\u5173\u603b\u63a7\u7684send_to_storage(connector_name, data_to_send)\u7684\u8c03\u7528<\/strong>\uff0c\u5e76\u975e\u540d\u4e3a&quot;IoT Gateway&quot;\u7684\u7f51\u5173\u603b\u63a7<\/li>\n<li>\u8fd0\u884c\u65f6\uff0c<strong>\u540c\u4e00\u4e2a\u534f\u8bae\uff0c\u53ef\u80fd\u6709\u591a\u4e2a\u8fde\u63a5\u5668\u5bf9\u8c61\u751a\u81f3\u8fde\u63a5\u5668\u7c7b<\/strong>\uff08Connector\uff09\u3002\u3001<\/li>\n<li>\u5982\u679c\u8fde\u63a5\u5668\u7684\u5b9e\u9645\u5f00\u53d1\u4eba\u5458\u4e0d\u91c7\u7528\u7279\u6b8a\u8bbe\u8ba1\uff0c<strong>\u5404\u8fde\u63a5\u5668\u5bf9\u8c61\u7684\u7ebf\u7a0b\uff08Thread\uff09\u76f8\u4e92\u72ec\u7acb<\/strong>[^\u8fde\u63a5\u5668\u7ebf\u7a0b]\u3002<\/li>\n<li>\u6bcf\u4e2a<strong>\u8fde\u63a5\u5668\u5bf9\u8c61\u7684\u914d\u7f6e\u53d6\u51b3\u4e8e\u5176\u914d\u7f6e\u6587\u4ef6<\/strong>\uff0c\u5404\u534f\u8bae\u6240\u4f7f\u7528\u7684\u8fde\u63a5\u5668\u5bf9\u8c61\u7684<strong>\u540d\u79f0\u3001\u6570\u91cf\u3001\u76f8\u5e94\u7684\u8fde\u63a5\u5668\u7c7b\uff08class\uff09\u3001\u914d\u7f6e\u6587\u4ef6\u540d\u79f0<\/strong>\u7b49\u56db\u8005\u7684\u4fe1\u606f\u4f4d\u4e8e<strong>\u7f51\u5173\u914d\u7f6e\u6587\u4ef6\uff08tb_gateway.yaml\uff09<\/strong>\u3002<\/li>\n<li>\u7f51\u5173\u914d\u7f6e\u6587\u4ef6\uff08tb_gateway.yaml\uff09\u5185\u5e76\u4e0d\u5305\u542b\u7f51\u5173\u65e5\u5fd7\u914d\u7f6e\uff0c\u4f46\u542f\u7528\u7f51\u5173\u7684\u8fdc\u7a0b\u914d\u7f6e\u65f6\uff0c<strong>\u5e73\u53f0\u5411\u7f51\u5173\u4e0b\u53d1\u7684\u914d\u7f6e\u5374\u5fc5\u987b\u5305\u542b\u7f51\u5173\u65e5\u5fd7\u914d\u7f6e<\/strong>\u3002<\/li>\n<li>\u4e0e\u7f51\u5173\u76f8\u8fde\u7684&quot;Devices&quot;\u7684\u8303\u56f4\uff0c\u5728\u6982\u5ff5\u4e0a\u5305\u62ec\u4e86\u5f88\u591a\u5e38\u8bc6\u4e0a\u53ef\u80fd\u5e76\u4e0d\u88ab\u8ba4\u4e3a\u662f&quot;\u8bbe\u5907&quot;\u7684\u4e1c\u897f\uff0c\u6bd4\u5982\uff1adatabase\u3001webserver\u3001broker<\/li>\n<\/ul>\n<p>\u8fde\u63a5\u5668\u7ebf\u7a0b: \u8fde\u63a5\u5668\u7684\u7ebf\u7a0b\u95ee\u9898\u5728\u5f00\u53d1\u65f6\u5982\u679c\u4e0d\u88ab\u6ce8\u610f\uff0c\u786e\u5b9e\u53ef\u80fd\u5bfc\u81f4\u5404\u8fde\u63a5\u5668\u7684\u6570\u636e\u5e76\u4e0d\u5b89\u5168\uff0cTB\u7f51\u5173\u548cTB\u5e73\u53f0\u5bf9\u6b64\u6709\u4e13\u95e8\u7684\u5904\u7406\u65b9\u5f0f\u3002<\/p>\n<hr \/>\n<h2>4. \u53c2\u8003<\/h2>\n<p>ThingsBoard IoT Gateway\u5b98\u65b9\u5728\u7ebf\u6587\u6863\uff1a<a href=\"https:\/\/thingsboard.io\/docs\/iot-gateway\/what-is-iot-gateway\/\">https:\/\/thingsboard.io\/docs\/iot-gateway\/what-is-iot-gateway\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u6863\u65e5\u671f\uff1a2021\/10\/25 \u4f5c\u8005\uff1a\u6817\u6d69 1. ThingsBoard IoT Gateway\u6838\u5fc3\u6982\u5ff5 ThingsBoard IoT Gateway\u662f\u4e00\u4e2a\u7531ThingsBoard\u5b98\u65b9\u539f\u521b\u4e14\u5f00\u6e90\u7684\u7269\u2026<\/p>\n","protected":false},"author":3,"featured_media":128,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[2],"tags":[],"blocksy_meta":{"styles_descriptor":{"styles":{"desktop":"","tablet":"","mobile":""},"google_fonts":[],"version":5}},"_links":{"self":[{"href":"https:\/\/blog.osvlabs.com\/index.php?rest_route=\/wp\/v2\/posts\/127"}],"collection":[{"href":"https:\/\/blog.osvlabs.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.osvlabs.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.osvlabs.com\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.osvlabs.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=127"}],"version-history":[{"count":7,"href":"https:\/\/blog.osvlabs.com\/index.php?rest_route=\/wp\/v2\/posts\/127\/revisions"}],"predecessor-version":[{"id":139,"href":"https:\/\/blog.osvlabs.com\/index.php?rest_route=\/wp\/v2\/posts\/127\/revisions\/139"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.osvlabs.com\/index.php?rest_route=\/wp\/v2\/media\/128"}],"wp:attachment":[{"href":"https:\/\/blog.osvlabs.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=127"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.osvlabs.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=127"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.osvlabs.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=127"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}