This is an automated email from the ASF dual-hosted git repository.

haonan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/master by this push:
     new a009560f26 [IOTDB-5390] Keep mqtt_host same with rpc_address (#8831)
a009560f26 is described below

commit a009560f26d825cb551d411153bbb4694b5dd736
Author: 马子坤 <[email protected]>
AuthorDate: Thu Jan 12 14:24:34 2023 +0800

    [IOTDB-5390] Keep mqtt_host same with rpc_address (#8831)
---
 docs/UserGuide/API/Programming-MQTT.md                             | 2 +-
 docs/zh/UserGuide/API/Programming-MQTT.md                          | 2 +-
 node-commons/src/assembly/resources/conf/iotdb-common.properties   | 2 +-
 server/src/main/java/org/apache/iotdb/db/conf/IoTDBDescriptor.java | 4 ++++
 4 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/docs/UserGuide/API/Programming-MQTT.md 
b/docs/UserGuide/API/Programming-MQTT.md
index 9e882edeb7..93e952a1c7 100644
--- a/docs/UserGuide/API/Programming-MQTT.md
+++ b/docs/UserGuide/API/Programming-MQTT.md
@@ -66,7 +66,7 @@ Configurations are as follows:
 | NAME        | DESCRIPTION           | DEFAULT  |
 | ------------- |:-------------:|:------:|
 | enable_mqtt_service      | whether to enable the mqtt service | false |
-| mqtt_host      | the mqtt service binding host | 0.0.0.0 |
+| mqtt_host      | the mqtt service binding host | 127.0.0.1 |
 | mqtt_port      | the mqtt service binding port    |   1883 |
 | mqtt_handler_pool_size | the handler pool size for handing the mqtt messages 
     |    1 |
 | mqtt_payload_formatter | the mqtt message payload formatter     |    json |
diff --git a/docs/zh/UserGuide/API/Programming-MQTT.md 
b/docs/zh/UserGuide/API/Programming-MQTT.md
index 7ea0504fa3..57037ae75a 100644
--- a/docs/zh/UserGuide/API/Programming-MQTT.md
+++ b/docs/zh/UserGuide/API/Programming-MQTT.md
@@ -67,7 +67,7 @@ MQTT 主题与 IoTDB 时间序列相对应。
 | 名称      | 描述         | 默认 |
 | ------------- |:-------------:|:------:|
 | enable_mqtt_service      | 是否启用 mqtt 服务 | false |
-| mqtt_host      | mqtt 服务绑定主机 | 0.0.0.0 |
+| mqtt_host      | mqtt 服务绑定主机 | 127.0.0.1 |
 | mqtt_port      | mqtt 服务绑定端口 |   1883 |
 | mqtt_handler_pool_size | 处理 mqtt 消息的处理程序池大小 |    1 |
 | mqtt_payload_formatter | mqtt 消息有效负载格式化程序 |    json |
diff --git a/node-commons/src/assembly/resources/conf/iotdb-common.properties 
b/node-commons/src/assembly/resources/conf/iotdb-common.properties
index ee3616784d..2bfc8386cd 100644
--- a/node-commons/src/assembly/resources/conf/iotdb-common.properties
+++ b/node-commons/src/assembly/resources/conf/iotdb-common.properties
@@ -1006,7 +1006,7 @@ cluster_name=defaultCluster
 
 # the mqtt service binding host.
 # Datatype: String
-# mqtt_host=0.0.0.0
+# mqtt_host=127.0.0.1
 
 # the mqtt service binding port.
 # Datatype: int
diff --git a/server/src/main/java/org/apache/iotdb/db/conf/IoTDBDescriptor.java 
b/server/src/main/java/org/apache/iotdb/db/conf/IoTDBDescriptor.java
index fd6513a688..b8ef20d717 100644
--- a/server/src/main/java/org/apache/iotdb/db/conf/IoTDBDescriptor.java
+++ b/server/src/main/java/org/apache/iotdb/db/conf/IoTDBDescriptor.java
@@ -1290,6 +1290,10 @@ public class IoTDBDescriptor {
 
     if (properties.getProperty(IoTDBConstant.MQTT_HOST_NAME) != null) {
       conf.setMqttHost(properties.getProperty(IoTDBConstant.MQTT_HOST_NAME));
+    } else {
+      logger.info("MQTT host is not configured, will use dn_rpc_address.");
+      conf.setMqttHost(
+          properties.getProperty(IoTDBConstant.DN_RPC_ADDRESS, 
conf.getRpcAddress().trim()));
     }
 
     if (properties.getProperty(IoTDBConstant.MQTT_PORT_NAME) != null) {

Reply via email to