bash shell 脚本 检查运行的rabbitmq版本
时间: 2023-09-30 10:05:39 浏览: 106
可以使用以下命令来检查运行的 RabbitMQ 版本:
```
rabbitmqctl status | grep RabbitMQ
```
该命令将返回类似于以下内容的输出:
```
Status of node rabbit@localhost ...
[{pid,5478},
{running_applications,
[{rabbitmq_management,"RabbitMQ Management Console","3.8.3"},
{rabbitmq_web_dispatch,"RabbitMQ Web Dispatcher","3.8.3"},
{rabbitmq_management_agent,"RabbitMQ Management Agent","3.8.3"},
{rabbit,"RabbitMQ","3.8.3"},
{rabbit_common,[],"3.8.3"},
{ranch,"Socket acceptor pool for TCP protocols.","1.7.1"},
{ssl_transport,[],"1.0.3"},
{cowboy,"Small, fast, modular HTTP server.","2.7.0"}]},
{os,{unix,linux}},
{erlang_version,"22.2.6"},
{memory,[{total,17411424},
{connection_readers,0},
{connection_writers,0},
{connection_channels,0},
{connection_other,0},
{queue_procs,0},
{queue_slave_procs,0},
{plugins,0},
{other_proc,1818240},
{mnesia,71008},
{mgmt_db,0},
{msg_index,0},
{other_ets,954864},
{binary,1544},
{code,2770420},
{atom,1109377},
{other_system,12958263}]},
{alarms,[]},
{listeners,[{clustering,25672,"::"},{amqp,5672,"::"}]},
{vm_memory_high_watermark,0.4},
{vm_memory_limit,401620736},
{disk_free_limit,50000000},
{disk_free,32575135744},
{file_descriptors,[{total_limit,1048576},
{total_used,11},
{sockets_limit,943626},
{sockets_used,9}]},
{processes,[{limit,1048576},{used,322}]},
{run_queue,0},
{uptime,232}]
```
在这个例子中,我们可以看到运行的 RabbitMQ 版本是 "3.8.3"。如果您只想获取版本号,可以通过以下方式提取:
```
rabbitmqctl status | grep RabbitMQ | awk '{print $3}'
```
该命令将只返回 "3.8.3"。
阅读全文