日志
rabbitmq的日志默认存放在 /var/log/rabbitmq/ 中
代码语言:javascript复制[root@h102 ruby]# ll /var/log/rabbitmq/
total 64
-rw-r--r-- 1 rabbitmq rabbitmq 25009 Nov 18 20:59 rabbit@h102.log
-rw-r--r-- 1 rabbitmq rabbitmq 15882 Oct 23 17:20 rabbit@h102.log.1
-rw-r--r-- 1 rabbitmq rabbitmq 2064 Nov 18 17:11 rabbit@h102.log-20151028.gz
-rw-r--r-- 1 rabbitmq rabbitmq 1945 Nov 18 17:11 rabbit@h102.log-20151118
-rw-r--r-- 1 rabbitmq rabbitmq 0 Nov 18 17:11 rabbit@h102-sasl.log
-rw-r--r-- 1 rabbitmq rabbitmq 0 Oct 23 17:20 rabbit@h102-sasl.log.1
-rw-r--r-- 1 root root 0 Oct 24 00:22 shutdown_err
-rw-r--r-- 1 root root 42 Oct 24 00:22 shutdown_log
-rw-r--r-- 1 root root 0 Nov 18 16:13 startup_err
-rw-r--r-- 1 root root 340 Nov 18 16:13 startup_log
[root@h102 ruby]#
查看日志
代码语言:javascript复制[root@h102 ruby]# tail /var/log/rabbitmq/rabbit@h102.log
=WARNING REPORT==== 18-Nov-2015::20:58:38 ===
closing AMQP connection <0.3341.0> (127.0.0.1:41681 -> 127.0.0.1:5672):
connection_closed_abruptly
=WARNING REPORT==== 18-Nov-2015::20:58:40 ===
closing AMQP connection <0.3104.0> (127.0.0.1:41662 -> 127.0.0.1:5672):
connection_closed_abruptly
=INFO REPORT==== 18-Nov-2015::20:59:46 ===
accepting AMQP connection <0.3366.0> (127.0.0.1:41683 -> 127.0.0.1:5672)
[root@h102 ruby]#
Tip: 一般可以使用 tail -f /var/log/rabbitmq/rabbit@h102.log 的方式来实时跟踪当前的变化
状态查看
灵活使用下面的list命令可以更好了解当前MQ状态,详细用法可以参考 官方文档
代码语言:javascript复制[root@h102 ruby]# rabbitmqctl list_policies
Listing policies ...
[root@h102 ruby]# rabbitmqctl list_queues
Listing queues ...
mq_learning_q 0
ruby_test_q 0
[root@h102 ruby]# rabbitmqctl list_exchanges
Listing exchanges ...
direct
amq.direct direct
amq.fanout fanout
amq.headers headers
amq.match headers
amq.rabbitmq.log topic
amq.rabbitmq.trace topic
amq.topic topic
[root@h102 ruby]# rabbitmqctl list_bindings
Listing bindings ...
exchange mq_learning_q queue mq_learning_q []
exchange ruby_test_q queue ruby_test_q []
[root@h102 ruby]# rabbitmqctl list_connections
Listing connections ...
guest 127.0.0.1 41683 running
[root@h102 ruby]# rabbitmqctl list_channels
Listing channels ...
<rabbit@h102.1.3374.0> guest 1 0
[root@h102 ruby]# rabbitmqctl list_consumers
Listing consumers ...
ruby_test_q <rabbit@h102.1.3374.0> bunny-1447851586000-713632469015 false 0 []
[root@h102 ruby]#
原文地址