在centos8上面部署emqx5.5,过程中有许多问题。
第一种文件配置
node {name = "emqx-name@IP" #名称此处IP仅用于标识cookie = "GR7aqjZzt0IfcEEw" #此处数据自己设置data_dir = "data"
}cluster {name = emqxcl-V5-namediscovery_strategy = manual
}dashboard {listeners.http {bind = "0.0.0.0:18216" #公网IP控制台访问}
}listeners.tcp.internal {bind = "ip:port" #此处IP是内网IPmax_connections = 1024000mountpoint = ""enable_authn = quick_deny_anonymous
}listeners.tcp.default {bind = "0.0.0.0:18880"max_connections = 1024000enable_authn = quick_deny_anonymous
}listeners.ssl.default { #证书配置,测试,若为自身熟悉所用,则不用配置bind = "0.0.0.0:8905"max_connections = 1024000ssl_options {keyfile = "etc/配自己的路径和证书"certfile = "etc/同上"cacertfile = "etc/同上"}enable_authn = quick_deny_anonymous
}listeners.ws.default { #web使用bind = "0.0.0.0:8399"max_connections = 1024000enable_authn = quick_deny_anonymous
}listeners.wss.default { #生产环境使用,自己测试注释掉bind = "0.0.0.0:8301"max_connections = 1024000enable_authn = quick_deny_anonymousssl_options {keyfile = "etc/同上"certfile = "etc/同上"cacertfile = "etc/同上"}
}authorization {deny_action = ignoreno_match = denysources = [{type = fileenable = truepath = "etc/acl.conf"}]}log.file {enable = truelevel = debugformatter = texttime_offset = systemrotation_count = 10rotation_size = 128MB
}
如果是是自己的个人服务器部分内容一定要注释,否则会报错
第二种IP问题
能够成功启动但是dashboard访问不了,日志如下:
Listener tcp:default on 0.0.0.0:18880 started.
Listener tcp:internal on 10.2.8.2:11902 started.
Listener ssl:default on 0.0.0.0:8883 started.
Listener ws:default on 0.0.0.0:8399 started.
Listener wss:default on 0.0.0.0:8084 started.
2024-10-31T11:08:01.352409+08:00 [error] Failed to start Ranch listener ‘http:dashboard’ in ranch_tcp:listen([{cacerts,‘…’},{key,‘…’},{cert,‘…’},inet,{backlog,1024},{ip,{82,156,129,129}},{send_timeout,
10000},{port,18126}]) for reason eaddrnotavail (can’t assign requested address)
2024-10-31T11:08:01.352897+08:00 [error] crasher: initial call: supervisor:ranch_acceptors_sup/1, pid: <0.2882.0>, registered_name: , exit: {{listen_error,‘http:dashboard’,eaddrnotavail},[{ranch_acceptors_
sup,listen_error,5,[{file,“ranch_acceptors_sup.erl”},{line,66}]},{supervisor,init,1,[{file,“supervisor.erl”},{line,330}]},{gen_server,init_it,2,[{file,“gen_server.erl”},{line,980}]},{gen_server,init_it,6,[{f
ile,“gen_server.erl”},{line,935}]},{proc_lib,init_p_do_apply,3,[{file,“proc_lib.erl”},{line,241}]}]}, ancestors: [<0.2880.0>,ranch_sup,<0.2463.0>], message_queue_len: 0, messages: , links: [<0.2880.0>], di
ctionary: [{logger,error_logger}], trap_exit: true, status: running, heap_size: 2586, stack_size: 28, reductions: 7794; neighbours:
2024-10-31T11:08:01.353891+08:00 [error] Supervisor: {<0.2880.0>,ranch_listener_sup}. Context: start_error. Reason: {listen_error,‘http:dashboard’,eaddrnotavail}. Offender: id=ranch_acceptors_sup,pid=undefin
ed.
2024-10-31T11:08:01.355119+08:00 [error] msg: started_listener_failed, mfa: minirest:log_start_result/2(114), name: ‘http:dashboard’, port: 18126, reason: {listen_error,‘http:dashboard’,eaddrnotavail}, descr
iption: cannot_assign_requested_address
2024-10-31T11:08:01.355466+08:00 [error] crasher: initial call: application_master:init/4, pid: <0.2865.0>, registered_name: , exit: {{[‘http:dashboard’],{emqx_dashboard_app,start,[normal,]}},[{applicati
on_master,init,4,[{file,“application_master.erl”},{line,142}]},{proc_lib,init_p_do_apply,3,[{file,“proc_lib.erl”},{line,241}]}]}, ancestors: [<0.2864.0>], message_queue_len: 1, messages: [{‘EXIT’,<0.2866.0>,
normal}], links: [<0.2864.0>,<0.2021.0>], dictionary: , trap_exit: true, status: running, heap_size: 376, stack_size: 28, reductions: 168; neighbours:
2024-10-31T11:08:01.356142+08:00 [critical] msg: failed_to_start_app, mfa: emqx_machine_boot:start_one_app/1(110), reason: {emqx_dashboard,{[‘http:dashboard’],{emqx_dashboard_app,start,[normal,]}}}, app: e
mqx_dashboard
2024-10-31T11:08:01.356549+08:00 [error] Supervisor: {local,emqx_machine_sup}. Context: start_error. Reason: {‘EXIT’,{{failed_to_start_app,emqx_dashboard,{emqx_dashboard,{[‘http:dashboard’],{emqx_dashboard_a
pp,start,[normal,]}}}},[{emqx_machine_boot,start_one_app,1,[{file,“emqx_machine_boot.erl”},{line,111}]},{lists,foreach_1,2,[{file,“lists.erl”},{line,1686}]},{emqx_machine_boot,ensure_apps_started,0,[{file,
“emqx_machine_boot.erl”},{line,101}]},{emqx_machine_boot,post_boot,0,[{file,“emqx_machine_boot.erl”},{line,44}]},{supervisor,do_start_child_i,3,[{file,“supervisor.erl”},{line,420}]},{supervisor,do_start_chil
d,2,[{file,“supervisor.erl”},{line,406}]},{supervisor,‘-start_children/2-fun-0-’,3,[{file,“supervisor.erl”},{line,390}]},{supervisor,children_map,4,[{file,“supervisor.erl”},{line,1258}]},{supervisor,init_chi
ldren,2,[{file,“supervisor.erl”},{line,350}]},{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=emqx_machine_boot,pid=undefined.
2024-10-31T11:08:01.357192+08:00 [error] crasher: initial call: application_master:init/4, pid: <0.2188.0>, registered_name: , exit: {{{shutdown,{failed_to_start_child,emqx_machine_boot,{‘EXIT’,{{failed_to
_start_app,emqx_dashboard,{emqx_dashboard,{[‘http:dashboard’],{emqx_dashboard_app,start,[normal,]}}}},[{emqx_machine_boot,start_one_app,1,[{file,“emqx_machine_boot.erl”},{line,111}]},{lists,foreach_1,2,[{f
ile,“lists.erl”},{line,1686}]},{emqx_machine_boot,ensure_apps_started,0,[{file,“emqx_machine_boot.erl”},{line,101}]},{emqx_machine_boot,post_boot,0,[{file,“emqx_machine_boot.erl”},{line,44}]},{supervisor,do_
start_child_i,3,[{file,“supervisor.erl”},{line,420}]},{supervisor,do_start_child,2,[{file,“supervisor.erl”},{line,406}]},{supervisor,‘-start_children/2-fun-0-’,3,[{file,“supervisor.erl”},{line,390}]},{superv
isor,children_map,4,[{file,“supervisor.erl”},{line,1258}]},{supervisor,init_children,2,[{file,“supervisor.erl”},{line,350}]},{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}]}]}}}},{emqx_machine_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.2187.0>], message_queue_len: 1, messages: [{‘EXIT’,<0.2189.0>,normal}], links: [<0.2187.0>,<0.2021.0>], dictionar
y: , trap_exit: true, status: running, heap_size: 987, stack_size: 28, reductions: 249; neighbours:
Listener tcp:default on 0.0.0.0:18880 stopped.
Listener tcp:internal on 10.2.8.2:11902 stopped.
Listener ssl:default on 0.0.0.0:8883 stopped.
Listener ws:default on 0.0.0.0:8399 stopped.
Listener wss:default on 0.0.0.0:8084 stopped.
Kernel pid terminated (application_controller) ("{application_start_failure,emqx_machine,{{shutdown,{failed_to_start_child,emqx_machine_boot,{‘EXIT’,{{failed_to_start_app,emqx_dashboard,{emqx_dashboard,{['ht
tp:dashboard’],{emqx_dashboard_app,start,[normal,]}}}},[{emqx_machine_boot,start_one_app,1,[{file,"emqx_machine_boot.erl"},{line,111}]},{lists,foreach_1,2,[{file,"lists.erl"},{line,1686}]},{emqx_machin
e_boot,ensure_apps_started,0,[{file,"emqx_machine_boot.erl"},{line,101}]},{emqx_machine_boot,post_boot,0,[{file,"emqx_machine_boot.erl"},{line,44}]},{supervisor,do_start_child_i,3,[{file,"supervisor.erl
"},{line,420}]},{supervisor,do_start_child,2,[{file,"supervisor.erl"},{line,406}]},{supervisor,‘-start_children/2-fun-0-’,3,[{file,"supervisor.erl"},{line,390}]},{supervisor,children_map,4,[{file,"supe
rvisor.erl"},{line,1258}]},{supervisor,init_children,2,[{file,"supervisor.erl"},{line,350}]},{gen_server,init_it,2,[{file,"gen_server.erl"},{line,980}]},{gen_server,init_it,6,[{file,"gen_se
Crash dump is being written to: /root/emqx/log/erl_crash.dump…Segmentation fault (core dumped)
这个时候就是IP有问题,在配置文件中这一部分
dashboard {listeners {http {## Comment out 'bind' (or set bind=0) to disable listener.bind = 18126
将IP去掉,完成之后重启以下
第三种端口问题
重启之后又出现了下面的问题:
name: ‘http:dashboard’, port: 18126, reason: {listen_error,‘http:dashboard’,eaddrnotavail}
这个时候将端口换一个小一点的再重启以下
换了之后,出现这个问题:
Kernel pid terminated (application_controller) ("{application_start_failure,kernel,{{shutdown,{failed_to_start_child,on_load,{on_load_function_failed,quicer_nif,{error,{load_failed,"Failed to load NIF libra
这是缺少依赖导致的,安装一个依赖即可
yum -y install libatomic
rpm -qa | grep libatomic
安装依赖之后还是会报错
这时候使用下面这个命令:
./bin/emqx console
一点要把之前的emqx关闭,否则无法启动,这个时候如果出现如下输出就表示成功:
[root@VM-8-2-centos bin]# ./emqx consoleErlang/OTP 26 [erts-14.2.1] [emqx] [64-bit] [smp:2:2] [ds:2:2:8] [async-threads:4] [jit:ns]Listener tcp:default on 0.0.0.0:18880 started.Listener tcp:internal on 10.2.8.2:11902 started.Listener ssl:default on 0.0.0.0:8883 started.Listener ws:default on 0.0.0.0:8399 started.Listener wss:default on 0.0.0.0:8084 started.Listener http:dashboard on :1812 started.EMQX 5.5.0 is running now!Restricted Eshell V14.2.1 (press Ctrl+G to abort, type help(). for help)v5.5.0(emqxlin@82.156.129.129)1>
此时用你的IP地址加端口去访问dashboard就可以成功
输入默认的账号密码即可,默认账号:admin 密码:public