linux安装rabbitMQ
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了linux安装rabbitMQ相关的知识,希望对你有一定的参考价值。
linux 已经安装好docker环境。
rabbitMQ是一个消息队列软件
rabbitMQ的特性:消息持久化:从内存持久化消息到硬盘,再从硬盘加载到内存。
[root@manager1 home]# docker pull rabbitmq:3.10-management #拉取最新的镜像
[root@manager1 home]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
rabbitmq 3.10-management 6b94498c1b2f 3 weeks ago 262MB
[root@manager1 home]# docker run -d -it --name rabbitmq -e RABBITMQ_DEFAULT_USER=admin -e RABBITMQ_DEFAULT_PASS=123456 -p 5672:5672 -p 15672:15672 rabbitmq:3.10-management #运行容器
3812306d62b01cd31722fd762704844375e7b801ea42d579deffa8c917f9fb84
[root@manager1 home]# docker ps #查看运行起来的容器
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
3812306d62b0 rabbitmq:3.10-management "docker-entrypoint.s…" 2 seconds ago Up 2 seconds 4369/tcp, 5671/tcp, 0.0.0.0:5672->5672/tcp, 15671/tcp, 15691-15692/tcp, 25672/tcp, 0.0.0.0:15672->15672/tcp rabbitmq
备注:
-d: 保证容器后台允许
-i:即使没连接,也要保持标准输入保持打开状态
-t:分配一个伪tty,一般与-i一起使用。
-e:设置rabbitmq的账户和密码变量
增加备注:
查看rabbitmq当前用户列表
[root@manager1 home]# docker exec -it rabbitmq /bin/bash #进入rabbitmq容器
root@3812306d62b0:/# rabbitmqctl list_users #查看当前用户列表
Listing users ...
usertags
admin[administrator]
root@3812306d62b0:/# rabbitmqctl change_password admin 12345678 #修改密码
Changing password for user "admin" ...
修改密码后,rabbitMQ 的web界面会弹出重新输入账号和密码
rabbitMQ官网:https://www.rabbitmq.com/#features
rabbitmq端口说明
5672 :这是rabbitMQ的端口号;
15672 :这是那个RabbitMQ的web页面的端口号;
问题1:
linux内存不足导致rabbitMQ容器自动退出
rabbitMQ日志如下
22-09-16 09:02:55.630089+00:00 [error] <0.370.0> string,tokens,2,[file,"string.erl",line,1934],
2022-09-16 09:02:55.630089+00:00 [error] <0.370.0> rabbit_disk_monitor,parse_free_unix,1,
2022-09-16 09:02:55.630089+00:00 [error] <0.370.0> [file,"rabbit_disk_monitor.erl",line,262],
2022-09-16 09:02:55.630089+00:00 [error] <0.370.0> rabbit_disk_monitor,internal_update,1,
2022-09-16 09:02:55.630089+00:00 [error] <0.370.0> [file,"rabbit_disk_monitor.erl",line,216],
2022-09-16 09:02:55.630089+00:00 [error] <0.370.0> rabbit_disk_monitor,handle_info,2,
2022-09-16 09:02:55.630089+00:00 [error] <0.370.0> [file,"rabbit_disk_monitor.erl",line,166],
2022-09-16 09:02:55.630089+00:00 [error] <0.370.0> gen_server,try_dispatch,4,
2022-09-16 09:02:55.630089+00:00 [error] <0.370.0> [file,"gen_server.erl",line,695],
2022-09-16 09:02:55.630089+00:00 [error] <0.370.0> gen_server,handle_msg,6,
2022-09-16 09:02:55.630089+00:00 [error] <0.370.0> [file,"gen_server.erl",line,771],
2022-09-16 09:02:55.630089+00:00 [error] <0.370.0> proc_lib,init_p_do_apply,3,
2022-09-16 09:02:55.630089+00:00 [error] <0.370.0> [file,"proc_lib.erl",line,226]]
2022-09-16 09:02:55.630089+00:00 [error] <0.370.0> offender: [pid,<0.30257.38>,
2022-09-16 09:02:55.630089+00:00 [error] <0.370.0> id,rabbit_disk_monitor,
2022-09-16 09:02:55.630089+00:00 [error] <0.370.0> mfargs,rabbit_disk_monitor,start_link,[50000000],
2022-09-16 09:02:55.630089+00:00 [error] <0.370.0> restart_type,transient,1,
2022-09-16 09:02:55.630089+00:00 [error] <0.370.0> shutdown,300000,
2022-09-16 09:02:55.630089+00:00 [error] <0.370.0> child_type,worker]
2022-09-16 09:03:01.630751+00:00 [info] <0.23385.44> Enabling free disk space monitoring
2022-09-16 09:03:01.663287+00:00 [info] <0.23385.44> Disk free limit set to 50MB
eheap_alloc: Cannot allocate 1898305688 bytes of memory (of type "old_heap").
Crash dump is being written to: /var/log/rabbitmq/erl_crash.dump...done
rabbitMQ的特性:消息持久化:从内存持久化消息到硬盘,再从硬盘加载到内存。所以查看一下内存,发现swap的内存空间也用完了。后面给服务器增加内存,重新运行rabbitmq容器。
以上是关于linux安装rabbitMQ的主要内容,如果未能解决你的问题,请参考以下文章