环境
- EMQX 版本:V5.0.8 Docker部署单点节
- 操作系统版本:CentOS7.9
重现此问题的步骤
安装步骤:
创建挂载目录
mkdir -p /data/emqx/{bin,etc,lib,data,log}
运行镜像
docker run -d --name emqx
-p 1883:1883
-p 8083:8083
-p 8084:8084
-p 8883:8883
-p 18083:18083
–restart=always
emqx/emqx:5.0.8
将临时EMQX容器的文件拷贝到服务器
docker cp emqx:/opt/emqx/bin /data/emqx
docker cp emqx:/opt/emqx/etc /data/emqx
docker cp emqx:/opt/emqx/lib /data/emqx
docker cp emqx:/opt/emqx/log /data/emqx
docker cp emqx:/opt/emqx/data /data/emqx
修改挂载目录权限
chown -R 1000:1000 /data/emqx/
chmod -R 755 /data/emqx/
删除临时emqx容器
docker rm -f emqx
重新启动一个EMQX
docker run -d --name emqx5.0.8
-p 5883:1883
-p 5083:8083
-p 5084:8084
-p 5123:8883
-p 58083:18083
-v /data/emqx/bin:/opt/emqx/bin
-v /data/emqx/etc:/opt/emqx/etc
-v /data/emqx/lib:/opt/emqx/lib
-v /data/emqx/data:/opt/emqx/data
-v /data/emqx/log:/opt/emqx/log
-v /etc/localtime:/etc/localtime
–restart=always
emqx/emqx:5.0.8
以上是我用Docker部署的详细步骤
- 登录WEB管理页面,修改默认的密码
- 在管理页面创建认证,选择基于密码认证,再添加用户添加用户;
- 关键问题就是,这个EMQX在运行一段时间之后(这个时间多长没有统计 ,也不知道有不有规律),程序就连接不上,再次登录EMQX的管理页面,以前修改的密码登录不了,只能用程序默认的账号admin与密码public登录进去,进去之后,里面创建的密码认证与添加的用户也没有了,需要再重新创建认证与添加用户
预期行为
实际行为
2023-04-19T14:30:33.684026+08:00 [error] at_state: <<“clean”>>, input_bytes: <<0,40,24,48,152,50,0,0,0,0,0,0,0,2,0,1,134,160,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0>>, line: 772, mfa: emqx_connection:parse_incoming/2, parsed_packets: [{mqtt_packet,{mqtt_packet_header,8,false,1,false},undefined,undefined}], peername: 39.103.163.202:982, reason: function_clause, stacktrace: [{emqx_frame,parse_packet,[{mqtt_packet_header,0,false,0,false},<<24,48,152,50,0,0,0,0,0,0,0,2,0,1,134,160,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0>>,#{max_size => 1048576,strict_mode => false,version => 4}],[{file,“emqx_frame.erl”},{line,258}]},{emqx_frame,parse_frame,4,[{file,“emqx_frame.erl”},{line,231}]},{emqx_connection,parse_incoming,3,[{file,“emqx_connection.erl”},{line,750}]},{emqx_connection,handle_msg,2,[{file,“emqx_connection.erl”},{line,729}]},{emqx_connection,process_msg,2,[{file,“emqx_connection.erl”},{line,466}]},{emqx_connection,handle_recv,3,[{file,“emqx_connection.erl”},{line,428}]},{proc_lib,wake_up,3,[{file,“proc_lib.erl”},{line,236}]}]
[os_mon] memory supervisor port (memsup): Erlang has closed
!!!
WARNING: Default (insecure) Erlang cookie is in use.
WARNING: Configure node.cookie in /opt/emqx/etc/emqx.conf or override from environment variable EMQX_NODE__COOKIE
NOTE: Use the same config value for all nodes in the cluster.
!!!
rpc.port_discovery = EMQX_RPC__PORT_DISCOVERY = manual
log.file_handlers.default.enable = EMQX_LOG__FILE_HANDLERS__DEFAULT__ENABLE = false
log.console_handler.enable = EMQX_LOG__CONSOLE_HANDLER__ENABLE = true
node.name = EMQX_NODE__NAME = emqx@172.17.0.2
Listener ssl:default on :8883 started.
Listener tcp:default on :1883 started.
Listener ws:default on :8083 started.
Listener wss:default on :8084 started.
Listener http:dashboard on :18083 started.
EMQX 5.0.8 is running now