emqx创建资源时只能连接本机资源,不能连接其它服务器资源

emqx创建资源时只能连接本机资源,不能连接其它服务器资源,如连接TDEngine、MongoDB或Sqlserver都存在这种问题,是不是有其他设置?连接MongoDB时,显示27017端口是连接着的,但查看节点状态就是不可用的状态

看起来是网络方面的问题

网络连接正常,都在同一局域网

可以看一下 EMQX 的后台日志,一般都会有提示无法连接的原因的日志。

2023-02-23T14:34:48.673535+08:00 [error] crasher: initial call: mc_worker:init/1, pid: <0.5242.588>, registered_name: [], error: {{<<“Can’t pass authentification”>>,error,{badmatch,{false,#{<<“code”>> => 18,<<“codeName”>> => <<“AuthenticationFailed”>>,<<“errmsg”>> => <<“Authentication failed.”>>}}},[{mc_auth_logic,scram_first_step,5,[{file,“mc_auth_logic.erl”},{line,63}]},{mc_auth_logic,scram_sha_1_auth,5,[{file,“mc_auth_logic.erl”},{line,52}]},{mc_worker,auth_if_credentials,5,[{file,“mc_worker.erl”},{line,219}]},{mc_worker,init,1,[{file,“mc_worker.erl”},{line,54}]},{proc_lib,init_p_do_apply,3,[{file,“proc_lib.erl”},{line,226}]}]},[{mc_auth_logic,scram_sha_1_auth,5,[{file,“mc_auth_logic.erl”},{line,55}]},{mc_worker,auth_if_credentials,5,[{file,“mc_worker.erl”},{line,219}]},{mc_worker,init,1,[{file,“mc_worker.erl”},{line,54}]},{proc_lib,init_p_do_apply,3,[{file,“proc_lib.erl”},{line,226}]}]}, ancestors: [<0.30700.587>,<0.30712.587>,<0.27314.584>,<0.27262.584>,<0.27237.584>,<0.27312.584>,<0.27273.584>,ecpool_sup,<0.2489.0>], message_queue_len: 0, messages: [], links: [<0.30712.587>,#Port<0.4907602>,<0.30700.587>], dictionary: [{rand_seed,{#{jump => #Fun<rand.3.92093067>,max => 288230376151711743,next => #Fun<rand.5.92093067>,type => exsplus},[8455496651689376|265872912075503732]}}], trap_exit: false, status: running, heap_size: 1598, stack_size: 28, reductions: 10197; neighbours:

看日志是认证没通过,你是不是在资源侧配置了认证,可以检查下 EMQX 这边的连接配置。

2023-02-23T16:15:40.546443+08:00 [error] Generic server <0.1065.694> terminating. Reason: killed. Last message: {‘EXIT’,<0.1011.694>,killed}. State: {state,undefined,{10,80,20,110},27017,<0.23131.179>,<0.1011.694>,[{pool_size,1},{max_overflow,0},{overflow_ttl,1000},{overflow_check_period,1000},{localThresholdMS,1000},{socketTimeoutMS,100},{serverSelectionTimeoutMS,3000},{waitQueueTimeoutMS,1000},{heartbeatFrequencyMS,10000},{minHeartbeatFrequencyMS,1000}],[{w_mode,safe},{r_mode,master},{password,<<“admin”>>},{login,<<“admin”>>},{database,<<“gongfu”>>},{ssl,false}],undefined,20000,10000,1000,<0.1119.694>,1}.
2023-02-23T16:15:40.546596+08:00 [error] Supervisor: {<0.28634.693>,poolboy_sup}. Context: child_terminated. Reason: {{<<“Can’t pass authentification”>>,error,{badmatch,{false,#{<<“code”>> => 18,<<“codeName”>> => <<“AuthenticationFailed”>>,<<“errmsg”>> => <<“Authentication failed.”>>}}},[{mc_auth_logic,scram_first_step,5,[{file,“mc_auth_logic.erl”},{line,63}]},{mc_auth_logic,scram_sha_1_auth,5,[{file,“mc_auth_logic.erl”},{line,52}]},{mc_worker,auth_if_credentials,5,[{file,“mc_worker.erl”},{line,219}]},{mc_worker,init,1,[{file,“mc_worker.erl”},{line,54}]},{proc_lib,init_p_do_apply,3,[{file,“proc_lib.erl”},{line,226}]}]},[{mc_auth_logic,scram_sha_1_auth,5,[{file,“mc_auth_logic.erl”},{line,55}]},{mc_worker,auth_if_credentials,5,[{file,“mc_worker.erl”},{line,219}]},{mc_worker,init,1,[{file,“mc_worker.erl”},{line,54}]},{proc_lib,init_p_do_apply,3,[{file,“proc_lib.erl”},{line,226}]}]}. Offender: id=mc_worker,pid=<0.186.694>.
2023-02-23T16:15:40.547992+08:00 [error] crasher: initial call: mc_monitor:init/1, pid: <0.176.694>, registered_name: [], exit: {killed,[{gen_server,decode_msg,9,[{file,“gen_server.erl”},{line,481}]},{proc_lib,wake_up,3,[{file,“proc_lib.erl”},{line,236}]}]}, ancestors: [<0.990.694>,<0.23126.179>,<0.23118.179>,<0.23109.179>,<0.23107.179>,ecpool_sup,<0.2489.0>], message_queue_len: 0, messages: [], links: [<0.1081.694>], dictionary: [], trap_exit: true, status: running, heap_size: 4185, stack_size: 28, reductions: 8947; neighbours: neighbour: pid: <0.1081.694>, registered_name: [], initial_call: {mc_monitor,do_timeout,2}, current_function: {mc_monitor,do_timeout,2}, ancestors: [], message_queue_len: 0, links: [<0.176.694>], trap_exit: false, status: waiting, heap_size: 233, stack_size: 4, reductions: 10, current_stacktrace: [{mc_monitor,do_timeout,2,[{file,“mc_monitor.erl”},{line,162}]}]
2023-02-23T16:15:40.548135+08:00 [error] crasher: initial call: mc_monitor:init/1, pid: <0.1019.694>, registered_name: [], exit: {killed,[{gen_server,decode_msg,9,[{file,“gen_server.erl”},{line,481}]},{proc_lib,wake_up,3,[{file,“proc_lib.erl”},{line,236}]}]}, ancestors: [<0.1032.694>,<0.23146.179>,<0.23145.179>,<0.23109.179>,<0.23107.179>,ecpool_sup,<0.2489.0>], message_queue_len: 0, messages: [], links: [<0.1039.694>], dictionary: [], trap_exit: true, status: running, heap_size: 4185, stack_size: 28, reductions: 8947; neighbours: neighbour: pid: <0.1039.694>, registered_name: [], initial_call: {mc_monitor,do_timeout,2}, current_function: {mc_monitor,do_timeout,2}, ancestors: [], message_queue_len: 0, links: [<0.1019.694>], trap_exit: false, status: waiting, heap_size: 233, stack_size: 4, reductions: 10, current_stacktrace: [{mc_monitor,do_timeout,2,[{file,“mc_monitor.erl”},{line,162}]}]
“emqx.log.1” 11428L, 10485628C