linux查看rabbitmq版本
时间: 2023-05-31 11:19:42 浏览: 2594
### 回答1:
可以使用以下命令来查看RabbitMQ的版本:
rabbitmqctl status | grep RabbitMQ
其中,rabbitmqctl是RabbitMQ的控制命令,status表示查看RabbitMQ的状态,grep RabbitMQ是用来过滤出包含RabbitMQ关键字的信息。执行该命令后,会输出类似以下的信息:
Status of node 'rabbit@localhost' ...
[{pid,1234},
{running_applications,[{rabbit,"RabbitMQ","3.8.9"},
{rabbit_common,[],"3.8.9"},
{rabbitmq_management,"RabbitMQ Management","3.8.9"},
{rabbitmq_web_dispatch,"RabbitMQ Web Dispatcher","3.8.9"},
{webmachine,"webmachine","1.10.3"},
{mochiweb,"MochiMedia Web Server","2.20.1"}]},
{os,{unix,linux}},
{erlang_version,"22.3.4.16"},
{memory,[{total,123456789},
{connection_readers,},
{connection_writers,},
{connection_channels,},
{connection_other,},
{queue_procs,},
{queue_slave_procs,},
{plugins,},
{other_proc,123456789},
{mnesia,},
{mgmt_db,},
{msg_index,},
{other_ets,}]},
{alarms,[]},
{listeners,[{clustering,25672,"::"},{amqp,5672,"::"}]},
{vm_memory_high_watermark,.4},
{vm_memory_limit,1073741824},
{disk_free_limit,50000000},
{disk_free,123456789},
{file_descriptors,[{total_limit,924},
{total_used,4},
{sockets_limit,829},
{sockets_used,2}]},
{processes,[{limit,1048576},{used,123}]},
{run_queue,},
{uptime,123456789},
{kernel,{net_ticktime,60}}]
其中,RabbitMQ的版本号为3.8.9。
### 回答2:
RabbitMQ是一种开源的消息中间件,它支持多个协议,包括AMQP(高级消息队列协议)和STOMP(可简单传输消息协议),可以用于构建分布式应用程序。在Linux系统上,使用以下命令可以查看RabbitMQ版本:
1. 使用rabbitmqctl命令
先使用sudo命令切换到root用户,然后输入以下命令:
rabbitmqctl status
该命令将返回RabbitMQ服务器的状态信息,其中包括RabbitMQ服务器的本地版本信息。有时候,rabbitmqctl这个命令可能由于环境变量问题而无法找到。这种情况下,可以在命令前面加上sudo,以root用户的身份运行。
2. 使用rabbitmq-server命令
另一种查看RabbitMQ版本的方法是使用rabbitmq-server这个命令:
sudo rabbitmq-server -version
该命令将返回RabbitMQ服务器的版本信息。
无论是使用rabbitmqctl还是rabbitmq-server命令,都可以方便地查看RabbitMQ版本信息。在开发和测试过程中,需要不断了解所采用的技术栈中各种软件和工具的版本信息,以便进行问题排查和性能优化。
### 回答3:
在Linux系统中,我们可以通过多种方式来查看已安装的 RabbitMQ 版本。
1. 使用 rabbitmqctl 命令
rabbitmqctl 是 RabbitMQ 自带的命令行工具,我们可以通过执行以下命令来查看版本信息:
```
sudo rabbitmqctl status
```
执行完命令后,会输出 RabbitMQ 的版本信息,如下所示:
```
Status of node rabbit@localhost ...
[{pid,xxxx}, {running_applications,
[{rabbitmq_management,"RabbitMQ Management Console","3.9.7"},
{rabbitmq_web_dispatch,"RabbitMQ Web Dispatcher","3.9.7"},
{rabbitmq_management_agent,"RabbitMQ Management Agent","3.9.7"},
{rabbitmq_auth_backend_ldap,"LDAP Authentication Backend","3.9.7"},
{rabbitmq_auth_mechanism_ssl,"SSL Authentication Mechanism","3.9.7"},
{rabbitmq_shovel_management,"Shovel Management Plugin","3.9.7"},
{rabbitmq_auth_backend_cache,"Caching Authentication Backend","3.9.7"},
{rabbitmq_mqtt,"RabbitMQ MQTT Adapter","3.9.7"},
{rabbitmq_recent_history_exchange,"RabbitMQ Recent History Exchange","3.9.7"},
{rabbitmq_consistent_hash_exchange,"RabbitMQ Consistent Hash Exchange","3.9.7"},
{rabbitmq_federation_management,"Federation Management Plugin","3.9.7"},
{rabbitmq_event_exchange,"RabbitMQ Event Exchange","3.9.7"},
{rabbitmq_federation,"RabbitMQ Federation","3.9.7"},
{rabbitmq_random_exchange,"RabbitMQ Random Exchange","3.9.7"},
{rabbitmq_amqp1_0,"AMQP 1.0 support plugin","3.9.7"},
{rabbitmq_management_visualiser,"RabbitMQ Management Visualiser","3.9.7"},
{rabbit,"RabbitMQ","3.9.7"},
{rabbit_common,[],"3.9.7"},
{amqp_client,"RabbitMQ AMQP Client","5.6.0"},
{rabbitmq_prometheus,"RabbitMQ Prometheus Adapter","3.9.7"}]},
{os,{unix,linux}},
{erlang_version,"24.0.5"},
{memory,[{connection_readers,0},
{connection_writers,0},
{connection_channels,0},
{connection_other,13776},
{queue_procs,27512},
{queue_slave_procs,0},
{plugins,0},
{other_proc,106791992},
{mnesia,117776},
{mgmt_db,0},
{msg_index,0},
{other_ets,3172904},
{binary,68324},
{code,27758417},
{atom,235669},
{other_system,12130443}]},
{disk_free_limit,50000000},
{disk_free,192183007232},
{file_descriptors,[{total_limit,1048576},
{total_used,604},
{sockets_limit,943626},
{sockets_used,588}]},
{processes,[{limit,1048576},{used,296}]},
{run_queue,0},
{uptime,576},
{kernel,{net_ticktime,60}}]
```
在上述输出结果中,我们可以看到 RabbitMQ 的版本号是 “{rabbit,"RabbitMQ","3.9.7"}” .
2. 查看 RabbitMQ 安装目录下的版本文件
在 Linux 中,RabbitMQ 的版本文件位于 /usr/lib/rabbitmq/erlang/lib/rabbitmq_server-x.x.x/ebin/ 目录下,我们可以通过 cd 命令切换到该目录下,执行 ls 命令查看可以看到版本文件名类似 rabbit_common-3.9.7.ez,其中 3.9.7 即为 RabbitMQ 当前的版本。
3. 查看 erlang 包依赖版本
RabbitMQ 是基于 Erlang 编写的,我们可以通过执行以下命令来查看 erlang 依赖的 RabbitMQ 版本:
```
sudo erl -eval '{ok, A} = file:read_file(filename:join([code:root_dir(), "lib", "rabbitmq_server-3.9.7", "ebin", "rabbit.app"])), {ok, [{version, V}]} = re:run(A, ".*{version, \"(\\d+\\.\\d+\\.\\d+)\"}.*", [{capture, [1]}]), io:format("~s~n", [V]), halt().' -noshell
```
执行完命令后,会输出 RabbitMQ 的版本信息,如下所示:
```
"3.9.7"
```
以上是 Linux 查看 RabbitMQ 版本的三种方式。
阅读全文