start.sh
分析:
create_trace.sh
分析:
使用 rabbitmqctl 访问一个不存在的 node ,确认命令的执行并未卡住
install.sh
从以下几处信息可知
RabbitMQ has a "firehose" feature, where the administrator can enable (on a per-node, per-vhost basis) an exchange to which publish- and delivery-notifications should be CCed.
无论是针对 firehose 的介绍,还是基于 rabbitmq_tracing 插件的说明 ,均指出该功能仅适用于开发和调试阶段,以及开发和 QA 环境
从 firehose 的角度
从 rabbitmq_tracing 的角度
详见本文最后的“实验”内容
Note that the firehose state is not persistent; it will default of off at server start time.
TL;DR If rabbitmq_tracing plugin is also enabled and the administrator stops the last Trace, it will disable Firehose tracing entirely in addition to stopping the Trace instance.
Having Firehose enabled has a negative performance impact even when there are no bindings on amq.rabbitmq.trace. Furthermore, it has a significant performance penalty when we define traces.
Don't forget to clean up any queues that were used to consume events from the Firehose.
It is now possible to set up a tracer on any cluster node via management UI and HTTP API.GitHub issue: rabbitmq/rabbitmq-tracing#24
Plugins are activated when a node is started or at runtime when a CLI tool is used. For a plugin to be activated at boot, it must be enabled. To enable a plugin, use the rabbitmq-plugins.
The rabbitmq-plugins command enables or disables plugins by contacting the running node to tell it to start or stop plugins as needed. It is possible to contact an arbitrary node -n option to specify a different node.
Having a node running before the plugins are enabled is not always practical or operator-friendly. For those cases rabbitmq-plugins provides an alternative way. If the --offline flag is specified, the tool will not contact any nodes and instead will modify the file containing the list of enabled plugins (appropriately named enabled_plugins) directly. This option is often optimal for node provisioning automation.
该实验的前提是“由于目前的架构设计,导致不得不利用 RabbitMQ 的 tracing 功能干一些xxx事情”,因此,这里要探究的是,组内目前的脚本编写是否合理;
操作流程如下:
rabbitmqctl trace_off
命令将 rabbit1 和 rabbit2 上的 firehose 功能关掉(默认就是关的,这里是为了加强一下这个条件)rabbitmq-plugins disable rabbitmq_tracing
命令将 rabbit1 和 rabbit2 上的 rabbitmq_tracing 插件去使能rabbit1 上执行
rabbit2 上执行
从 rabbitmq 日志中可以看到
此时,从管理界面上看,节点 rabbit1 和 rabbit2 上显示的内容完全相同,以 rabbit1 为例
server 日志输出如下
此时,从管理页面上可以看到,rabbit1 比 rabbit2 多了名为 tracing 的 tab
确认 rabbit2 上的插件状态,没有变化
页面上也没有变化
重新确认 tracing 状态,发现已经变成 true
从 server 日志中也可以看出,创建 trace 规则后,会自动使能 tracing 功能
该 queue 状态如图所示
可以发现,trace 日志内容有了更新(这里由于 Pattern 配置的原因,trace log 仅被写入到了 my-trace.log 中)
折腾了这么多,结论如下
原创不易,添加关注,点赞,在看,分享是最好的支持, 谢谢~
更多精彩内容,欢迎关注微信公众号 西风冷楼阙
|