linux 如何查看rabbitmq是否在运行呢
时间: 2024-03-12 10:46:09 浏览: 22
可以通过以下命令来查看RabbitMQ是否在运行:
```
sudo rabbitmqctl status
```
如果RabbitMQ正在运行,则会显示类似于以下内容的输出:
```
Status of node rabbit@localhost ...
[{pid,XXXXX},
{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"},
{os_mon,"CPO CXC 138 46","2.4.7"},
{cowboy,"Small, fast, modular HTTP server.","1.0.4"},
{mnesia,"MNESIA CXC 138 12","4.15.5"},
{rabbitmq_stream,"RabbitMQ Stream","0.1.0"},
{metrics,"Erlang metrics handler","4.0.1"},
{jsx,"a streaming, evented json parsing toolkit","2.9.0"}]},
{os,{unix,linux}},
{erlang_version,"22.3.4.6"},
{memory,
[{total,140574248},
{connection_readers,0},
{connection_writers,0},
{connection_channels,0},
{connection_other,0},
{queue_procs,0},
{queue_slave_procs,0},
{plugins,0},
{other_proc,3024984},
{mnesia,70680},
{mgmt_db,0},
{msg_index,15784},
{other_ets,1137880},
{binary,8544},
{code,28529023},
{atom,1026601},
{other_system,5223542}]},
{alarms,[]},
{listeners,[{clustering,25672,"::"},{amqp,5672,"::"}]},
{vm_memory_high_watermark,0.4},
{vm_memory_limit,671088640},
{disk_free_limit,50000000},
{disk_free,199438159872},
{file_descriptors,
[{total_limit,924},
{total_used,4},
{sockets_limit,829},
{sockets_used,2}]},
{processes,[{limit,1048576},{used,121}]},
{run_queue,0},
{uptime,1868}]
```
如果RabbitMQ没有在运行,则会显示类似于以下内容的输出:
```
Error: unable to connect to node rabbit@localhost: nodedown
DIAGNOSTICS
===========
attempted to contact: [rabbit@localhost]
rabbit@localhost:
* connected to epmd (port 4369) on localhost
* epmd reports: node 'rabbit' not running at all
no other nodes on localhost
* suggestion: start the node
current node details:
- node name: 'rabbitmqcli-31738-rabbit@localhost'
- home dir: /home/user
- cookie hash: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
```