RabbitMQ Windows Server R2部署问题总结
实行rabbitmqctl list_queues 控制台提示’SetConsoleMode’,‘虏脦脢媒麓铆脦贸隆拢\r\n’
安装部署版本为:
rabbitMQ:rabbitmq-server-3.13.3
erlang: otp_win64_27.0
提示以下异常堆栈信息:
- Microsoft Windows [版本 6.3.9600]
- (c) 2013 Microsoft Corporation。保留所有权利。
- D:\RabbitMQ Server\rabbitmq_server-3.13.3\sbin>rabbitmq-plugins list
- =ERROR REPORT==== 29-Jun-2024::16:44:05.141000 ===
- ** State machine user_drv terminating
- ** When server state = {undefined,undefined}
- ** Reason for termination = error:{badmatch,
- {error,
- {'SetConsoleMode','虏脦脢媒麓铆脦贸隆拢\r\n'
- }}}
- ** Callback modules = [user_drv]
- ** Callback mode = state_functions
- ** Stacktrace =
- ** [{prim_tty,init,1,[{file,"prim_tty.erl"},{line,255}]},
- {user_drv,init,1,[{file,"user_drv.erl"},{line,175}]},
- {gen_statem,init_it,6,[{file,"gen_statem.erl"},{line,2695}]},
- {proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,329}]}]
- =CRASH REPORT==== 29-Jun-2024::16:44:05.141000 ===
- crasher:
- initial call: user_drv:init/1
- pid: <0.65.0>
- registered_name: []
- exception error: no match of right hand side value
- {error,{'SetConsoleMode','虏脦脢媒麓铆脦贸隆拢\r\n'}}
- in function prim_tty:init/1 (prim_tty.erl, line 255)
- in call from user_drv:init/1 (user_drv.erl, line 175)
- in call from gen_statem:init_it/6 (gen_statem.erl, line 2695)
- ancestors: [<0.64.0>,kernel_sup,<0.47.0>]
- message_queue_len: 0
- messages: []
- links: []
- dictionary: []
- trap_exit: true
- status: running
- heap_size: 610
- stack_size: 29
- reductions: 534
- neighbours:
- =CRASH REPORT==== 29-Jun-2024::16:44:15.412000 ===
- crasher:
- initial call: supervisor_bridge:user_sup/1
- pid: <0.64.0>
- registered_name: []
- exception exit: nouser
- in function gen_server:init_it/6 (gen_server.erl, line 2038)
- ancestors: [kernel_sup,<0.47.0>]
- message_queue_len: 0
- messages: []
- links: [<0.49.0>]
- dictionary: []
- trap_exit: true
- status: running
- heap_size: 987
- stack_size: 29
- reductions: 671
- neighbours:
- =SUPERVISOR REPORT==== 29-Jun-2024::16:44:15.412000 ===
- supervisor: {local,kernel_sup}
- errorContext: start_error
- reason: nouser
- offender: [{pid,undefined},
- {id,user},
- {mfargs,{user_sup,start,[]}},
- {restart_type,temporary},
- {significant,false},
- {shutdown,2000},
- {child_type,supervisor}]
- =CRASH REPORT==== 29-Jun-2024::16:44:15.412000 ===
- crasher:
- initial call: application_master:init/3
- pid: <0.46.0>
- registered_name: []
- exception exit: {{shutdown,{failed_to_start_child,user,nouser}},
- {kernel,start,[normal,[]]}}
- in function application_master:init/3 (application_master.erl, line 143)
- ancestors: [application_controller,<0.10.0>]
- message_queue_len: 1
- messages: [{'EXIT',<0.47.0>,normal}]
- links: [<0.45.0>]
- dictionary: []
- trap_exit: true
- status: running
- heap_size: 233
- stack_size: 29
- reductions: 63
- neighbours:
复制代码 Erlang/OTP 26 or later requires Windows 10 Threshold 2 (TH2), also known as the “November Update”, which is version 1511 and has the build number 10586. This would be the same as Windows Server 2016 I think.
Since Windows 2012 R2 is not supported by Microsoft anymore I suggest you update your OS.
If you do need to continue running 2012 you have two options:
Use an older Erlang version
Try any of the workarounds mentioned here: https://stackoverflow.com/a/44482740
该文提到erlang/OTP 26需要windows10以上内核。不在支持windows 2012 R2 更新了。提出的发起是更换服务器体系大概使用较为旧版的erlang版本
1、替换erlang版本
2、更新服务器体系版本
我更版本为:
rabbitMQ: 3.10.25
erlang: 25.3.2.12
RabbitMQ与Erlang对应版本关系图
到这里完善安装!!!
RabbitMQ服务一会主动掉线问题
运行 rabbitmq-server start
- Error during startup: {error,{schema_integrity_check_failed,[{table_missing,rabbit_listener}]}}```
复制代码 原因是:原先的RabbitMq数据与新的RabbitMq有些不兼容
解决方案:
sudo rm -rf /var/lib/rabbitmq/mnesia
win解决方案,在 RabbitMQ 安装目录中找到 mnesia 目录(通常在 C:\Users\AppData\Roaming\RabbitMQ\db),然后删除其中的文件
应用程序连上服务端提示 org.springframework.amqp.rabbit.listener.exception.FatalListenerStartupException: Authentication failure
原因是:应用端用guest去登录服务器是不被允许的,guest账号的策略只能在localhost本地登录不能远端登录。
解决方案:
–创建用户
rabbitmqctl add_user youName youPassWord
–赋予权限
rabbitmqctl set_permissions -p / youName “." ".” “.*”
应用端提示Shutdown Signal: channel error; protocol method: #method<channel.close>(reply-code=406, reply-text=PRECONDITION_FAILED - unknown delivery tag 1, class-id=60, method-id=80) 问题处理
原因是:默认情况下 RabbitMQ 是主动ACK(确认签收)机制,就意味着 MQ 会在消息发送完毕后,主动帮我们去ACK(确认),如果在代码中再手动确认签收,就会造成确认错误
解决方案
因此我们需要在消费者方法上标识,消息手动确认签收ackMode = “MANUAL”,spring-boot中 注入代码如下
- @Bean
- public SimpleRabbitListenerContainerFactory rabbitListenerContainerFactory(ConnectionFactory connectionFactory) {
- SimpleRabbitListenerContainerFactory factory = new SimpleRabbitListenerContainerFactory();
- factory.setConnectionFactory(connectionFactory);
- factory.setAcknowledgeMode(AcknowledgeMode.MANUAL); // 设置为手动确认
- factory.setPrefetchCount(1); // 设置预取数量
- // 根据需要设置其他属性
- return factory;
- }
复制代码 Windows下运行rabbitmqctl 相关下令(如rabbitmqctl stop)报错:Error: unable to perform an operation on node解决方案
解决方案
将C:\Users{用户名}.erlang.cookie 复制到 C:\Windows\System32\config\systemprofile目录。重启rabbitMQ服务
添加微信,_ 随时关注新资源文章。
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。 |