luxingwen / emqx_persistence_plugin

Apache License 2.0
67 stars 30 forks source link

能给一个详细的说明文档吗?运行没有效果 #14

Open gifter123 opened 2 months ago

gifter123 commented 2 months ago

编译完成,可以运行,按照我建立了一个mqtt_database的数据库,并按照mysql.sql 建立了表,将 etc/emqx_persistence_mysql.conf 修改后,拷贝到emqx的执行路径的etc目录下,在emqx_dashboard中启动emqx_persistence_mysql插件后,在emqx_dashboard中显示,运行中,发送“$MYSQL”主题的hello world后,数据库并没有任何记录,on_client_connected也没任何记录。 日志: 2024-06-24T20:03:26.180536+08:00 [error] 1e2ca43c-8bb8-48f1-a15b-4cd0a4f040011719230601492@172.27.176.1:53392 [Hooks] Failed to execute {emqx_persistence_mysql,on_session_subscribed,[[]]}: {error,undef,[{emqx_persistence_mysql,on_session_subscribed,[#{anonymous => true,auth_result => success,clientid => <<"1e2ca43c-8bb8-48f1-a15b-4cd0a4f040011719230601492">>,is_bridge => false,is_superuser => false,mountpoint => undefined,peerhost => {172,27,176,1},protocol => mqtt,sockport => 1883,username => <<"xh">>,zone => external},<<"MYSQL">>,#{is_new => true,nl => 0,qos => 0,rap => 0,rh => 0,sub_props => #{}},[]],[]},{emqx_hooks,safe_execute,2,[{file,"emqx_hooks.erl"},{line,191}]},{emqx_hooks,do_run,2,[{file,"emqx_hooks.erl"},{line,157}]},{emqx_session,subscribe,4,[{file,"emqx_session.erl"},{line,249}]},{emqx_channel,do_subscribe,3,[{file,"emqx_channel.erl"},{line,659}]},{emqx_channel,process_subscribe,4,[{file,"emqx_channel.erl"},{line,644}]},{emqx_channel,handle_in,2,[{file,"emqx_channel.erl"},{line,636}]},{emqx_connection,with_channel,3,[{file,"emqx_connection.erl"},{line,659}]},{emqx_connection,process_msg,2,[{file,"emqx_connection.erl"},{line,364}]},{emqx_connection,process_msg,2,[{file,"emqx_connection.erl"},{line,370}]},{emqx_connection,handle_recv,3,[{file,"emqx_connection.erl"},{line,328}]},{proc_lib,wake_up,3,[{file,"proc_lib.erl"},{line,236}]}]}

gifter123 commented 1 month ago

我知道答案了,数据库名必须为mqtt才行