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

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


The following commit(s) were added to refs/heads/rel/1.0 by this push:
     new dc3830b274 [To rel/1.0][IOTDB-5390] Keep mqtt_host being same with 
rpc_address (#8815)
dc3830b274 is described below

commit dc3830b2745b084bea86cf78a08d0c97317575d9
Author: 马子坤 <[email protected]>
AuthorDate: Thu Jan 12 14:25:46 2023 +0800

    [To rel/1.0][IOTDB-5390] Keep mqtt_host being same with rpc_address (#8815)
---
 docs/UserGuide/API/Programming-MQTT.md                   | 16 ++++++++--------
 docs/zh/UserGuide/API/Programming-MQTT.md                |  2 +-
 .../src/assembly/resources/conf/iotdb-common.properties  |  2 +-
 .../java/org/apache/iotdb/db/conf/IoTDBDescriptor.java   |  4 ++++
 4 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/docs/UserGuide/API/Programming-MQTT.md 
b/docs/UserGuide/API/Programming-MQTT.md
index 9e882edeb7..0f1c83df1c 100644
--- a/docs/UserGuide/API/Programming-MQTT.md
+++ b/docs/UserGuide/API/Programming-MQTT.md
@@ -63,14 +63,14 @@ The IoTDB MQTT service load configurations from 
`${IOTDB_HOME}/${IOTDB_CONF}/iot
 
 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_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 |
-| mqtt_max_message_size | the max mqtt message size in byte|   1048576 |
+| NAME        | DESCRIPTION           |  DEFAULT  |
+| ------------- |:-------------:|:---------:|
+| enable_mqtt_service      | whether to enable the mqtt service |   false   |
+| 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    |
+| mqtt_max_message_size | the max mqtt message size in byte|  1048576  |
 
 
 ### Coding Examples
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 16e30a896a..92b135eb87 100644
--- a/node-commons/src/assembly/resources/conf/iotdb-common.properties
+++ b/node-commons/src/assembly/resources/conf/iotdb-common.properties
@@ -1011,7 +1011,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 07ef09464d..d2450fa457 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
@@ -1298,6 +1298,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