From 3b90d145a4d1060840c69614eb43e49acc227d44 Mon Sep 17 00:00:00 2001 From: heavyrian2012 Date: Tue, 28 Jun 2022 08:34:17 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E7=BB=91=E5=AE=9AIP=E5=9C=B0?= =?UTF-8?q?=E5=9D=80=E7=9A=84=E9=85=8D=E7=BD=AE=EF=BC=8C=E9=98=B2=E6=AD=A2?= =?UTF-8?q?=E5=AE=A2=E6=88=B7=E8=AF=AF=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- broker/config/wildfirechat.conf | 5 +++-- .../main/java/io/moquette/server/netty/NettyAcceptor.java | 2 +- distribution/src/main/resources/wildfirechat.conf | 5 +++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/broker/config/wildfirechat.conf b/broker/config/wildfirechat.conf index 5f2e0657..d29fa3bd 100755 --- a/broker/config/wildfirechat.conf +++ b/broker/config/wildfirechat.conf @@ -26,8 +26,8 @@ http.admin.port 18080 ##节点ID,当集群部署时,一定不能有重复。 node_id 1 -##绑定IP,保持不变即可 -host 0.0.0.0 +##绑定IP,不要打开,除非有特殊需求才可以打开 +#host 0.0.0.0 ##本地绑定端口 local_port 80 @@ -38,6 +38,7 @@ embed.db 1 ## 是否自动清理历史消息记录,当为true时,IM服务会定时扫描t_messages_x和t_user_messages_x表,清除掉3年前的历史消息。 ## 如果不开启自动清理,需要手动清理t_messages_x和t_user_messages_x表内的历史数据,保存数据不能超过3年。 +## 如果需要消息保存更长时间,可以把临近销毁的消息转储到别的数据库,客户端在拉取不到服务器消息时,再去转储的数据库拉取。 ## 使用mongodb时次开关无效(因为mongodb设置了消息过期时间,会自动清理,仅专业版支持mongodb)。 db.auto_clean_history_messages true diff --git a/broker/src/main/java/io/moquette/server/netty/NettyAcceptor.java b/broker/src/main/java/io/moquette/server/netty/NettyAcceptor.java index 9359d337..b0ed56ab 100644 --- a/broker/src/main/java/io/moquette/server/netty/NettyAcceptor.java +++ b/broker/src/main/java/io/moquette/server/netty/NettyAcceptor.java @@ -160,7 +160,7 @@ public class NettyAcceptor implements ServerAcceptor { IConfig props) throws IOException { LOG.info("Configuring TCP MQTT transport"); final MoquetteIdleTimeoutHandler timeoutHandler = new MoquetteIdleTimeoutHandler(); - String host = props.getProperty(BrokerConstants.HOST_PROPERTY_NAME); + String host = props.getProperty(BrokerConstants.HOST_PROPERTY_NAME, "0.0.0.0"); String tcpPortProp = props.getProperty(PORT_PROPERTY_NAME, DISABLED_PORT_BIND); if (DISABLED_PORT_BIND.equals(tcpPortProp)) { LOG.info("Property {} has been set to {}. TCP MQTT will be disabled", BrokerConstants.PORT_PROPERTY_NAME, diff --git a/distribution/src/main/resources/wildfirechat.conf b/distribution/src/main/resources/wildfirechat.conf index 029178fc..f61f53ec 100755 --- a/distribution/src/main/resources/wildfirechat.conf +++ b/distribution/src/main/resources/wildfirechat.conf @@ -22,8 +22,8 @@ http.admin.port 18080 ##节点ID,当集群部署时,一定不能有重复。 node_id 1 -##绑定IP,保持不变即可 -host 0.0.0.0 +##绑定IP,不要打开,除非有特殊需求才可以打开 +#host 0.0.0.0 ##本地绑定端口 local_port 80 @@ -34,6 +34,7 @@ embed.db 1 ## 是否自动清理历史消息记录,当为true时,IM服务会定时扫描t_messages_x和t_user_messages_x表,清除掉3年前的历史消息。 ## 如果不开启自动清理,需要手动清理t_messages_x和t_user_messages_x表内的历史数据,保存数据不能超过3年。 +## 如果需要消息保存更长时间,可以把临近销毁的消息转储到别的数据库,客户端在拉取不到服务器消息时,再去转储的数据库拉取。 ## 使用mongodb时次开关无效(因为mongodb设置了消息过期时间,会自动清理,仅专业版支持mongodb)。 db.auto_clean_history_messages true