环境
- EMQX 版本:5.8.2
- 操作系统版本:ubuntu
我们在etcd上开启了ssl,参考了相关配置集群配置 | EMQX 5.8 文档
配置:
cluster {
name = "daily"
discovery_strategy = "etcd"
etcd {
server = "https://10.37.49.17:2379,https://10.37.50.230:2379,https://10.37.51.33:2379"
prefix = "2"
node_ttl = 1m
ssl_options {
keyfile = "/home/www/etcd-common-c0/client-key.pem"
cacertfile = "/home/www/etcd-common-c0/ca.pem"
certfile = "/home/www/etcd-common-c0/client.pem"
}
}
}
然后启动会报错
# emqx console
Erlang/OTP 26 [erts-14.2.5.2] [emqx] [64-bit] [smp:8:8] [ds:8:8:8] [async-threads:4] [jit:ns]
2025-09-08T17:32:03.596817+08:00 [warning] ekka_cluster_etcd failed to connect [10.37.49.17:2379] by <GRPC Unhealthy> {gun_stream_error,{closed,"The connection was lost."}}
2025-09-08T17:32:03.597090+08:00 [error] Failed to connect ETCD: {"10.37.49.17",2379} by {gun_stream_error,{closed,"The connection was lost."}}
2025-09-08T17:32:03.599450+08:00 [warning] ekka_cluster_etcd failed to connect [10.37.50.230:2379] by <GRPC Unhealthy> {gun_stream_error,{closed,"The connection was lost."}}
2025-09-08T17:32:03.599584+08:00 [error] Failed to connect ETCD: {"10.37.50.230",2379} by {gun_stream_error,{closed,"The connection was lost."}}
2025-09-08T17:32:03.602119+08:00 [warning] ekka_cluster_etcd failed to connect [10.37.51.33:2379] by <GRPC Unhealthy> {gun_stream_error,{closed,"The connection was lost."}}
2025-09-08T17:32:03.602372+08:00 [error] Failed to connect ETCD: {"10.37.51.33",2379} by {gun_stream_error,{closed,"The connection was lost."}}
2025-09-08T17:32:03.602633+08:00 [error] crasher: initial call: ekka_cluster_etcd:init/1, pid: <0.2394.0>, registered_name: [], error: {{badmatch,{error,[{{"10.37.51.33",2379},{gun_stream_error,{closed,"The connection was lost."}}},{{"10.37.50.230",2379},{gun_stream_error,{closed,"The connection was lost."}}},{{"10.37.49.17",2379},{gun_stream_error,{closed,"The connection was lost."}}}]}},[{ekka_cluster_etcd,init,1,[{file,"ekka_cluster_etcd.erl"},{line,357}]},{gen_server,init_it,2,[{file,"gen_server.erl"},{line,980}]},{gen_server,init_it,6,[{file,"gen_server.erl"},{line,935}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,241}]}]}, ancestors: [ekka_cluster_sup,ekka_sup,<0.2391.0>], message_queue_len: 0, messages: [], links: [<0.2393.0>], dictionary: [], trap_exit: true, status: running, heap_size: 987, stack_size: 28, reductions: 342; neighbours:
2025-09-08T17:32:03.603216+08:00 [error] Supervisor: {local,ekka_cluster_sup}. Context: start_error. Reason: {{badmatch,{error,[{{"10.37.51.33",2379},{gun_stream_error,{closed,"The connection was lost."}}},{{"10.37.50.230",2379},{gun_stream_error,{closed,"The connection was lost."}}},{{"10.37.49.17",2379},{gun_stream_error,{closed,"The connection was lost."}}}]}},[{ekka_cluster_etcd,init,1,[{file,"ekka_cluster_etcd.erl"},{line,357}]},{gen_server,init_it,2,[{file,"gen_server.erl"},{line,980}]},{gen_server,init_it,6,[{file,"gen_server.erl"},{line,935}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,241}]}]}. Offender: id=ekka_cluster_etcd,pid=undefined.
2025-09-08T17:32:03.603431+08:00 [error] Supervisor: {local,ekka_sup}. Context: start_error. Reason: {shutdown,{failed_to_start_child,ekka_cluster_etcd,{{badmatch,{error,[{{"10.37.51.33",2379},{gun_stream_error,{closed,"The connection was lost."}}},{{"10.37.50.230",2379},{gun_stream_error,{closed,"The connection was lost."}}},{{"10.37.49.17",2379},{gun_stream_error,{closed,"The connection was lost."}}}]}},[{ekka_cluster_etcd,init,1,[{file,"ekka_cluster_etcd.erl"},{line,357}]},{gen_server,init_it,2,[{file,"gen_server.erl"},{line,980}]},{gen_server,init_it,6,[{file,"gen_server.erl"},{line,935}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,241}]}]}}}. Offender: id=ekka_cluster_sup,pid=undefined.
2025-09-08T17:32:03.603689+08:00 [error] crasher: initial call: application_master:init/4, pid: <0.2390.0>, registered_name: [], exit: {{{shutdown,{failed_to_start_child,ekka_cluster_sup,{shutdown,{failed_to_start_child,ekka_cluster_etcd,{{badmatch,{error,[{{"10.37.51.33",2379},{gun_stream_error,{closed,"The connection was lost."}}},{{"10.37.50.230",2379},{gun_stream_error,{closed,"The connection was lost."}}},{{"10.37.49.17",2379},{gun_stream_error,{closed,"The connection was lost."}}}]}},[{ekka_cluster_etcd,init,1,[{file,"ekka_cluster_etcd.erl"},{line,357}]},{gen_server,init_it,2,[{file,"gen_server.erl"},{line,980}]},{gen_server,init_it,6,[{file,"gen_server.erl"},{line,935}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,241}]}]}}}}},{ekka_app,start,[normal,[]]}},[{application_master,init,4,[{file,"application_master.erl"},{line,142}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,241}]}]}, ancestors: [<0.2389.0>], message_queue_len: 1, messages: [{'EXIT',<0.2391.0>,normal}], links: [<0.2389.0>,<0.2119.0>], dictionary: [], trap_exit: true, status: running, heap_size: 987, stack_size: 28, reductions: 205; neighbours:
2025-09-08T17:32:03.604773+08:00 [error] msg: Mria callback crashed, error: {badmatch,{error,{ekka,{{shutdown,{failed_to_start_child,ekka_cluster_sup,{shutdown,{failed_to_start_child,ekka_cluster_etcd,{{badmatch,{error,[{{"10.37.51.33",2379},{gun_stream_error,{closed,"The connection was lost."}}},{{"10.37.50.230",2379},{gun_stream_error,{closed,"The connection was lost."}}},{{"10.37.49.17",2379},{gun_stream_error,{closed,"The connection was lost."}}}]}},[{ekka_cluster_etcd,init,1,[{file,"ekka_cluster_etcd.erl"},{line,357}]},{gen_server,init_it,2,[{file,"gen_server.erl"},{line,980}]},{gen_server,init_it,6,[{file,"gen_server.erl"},{line,935}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,241}]}]}}}}},{ekka_app,start,[normal,[]]}}}}}, callback: start, stacktrace: [{ekka,start,0,[{file,"ekka.erl"},{line,100}]},{mria_lib,exec_callback,2,[{file,"mria_lib.erl"},{line,233}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,241}]}]
Runtime terminating during boot (terminating)
Crash dump is being written to: /var/log/emqx/erl_crash.dump...done
当前机器验证etcd都是通的
# curl -k --cert /home/www/etcd-common-c0/client.pem --key /home/www/etcd-common-c0/client-key.pem --cacert /home/www/etcd-common-c0/ca.pem https://10.37.49.17:2379/health
{"health":"true","reason":""}