简体   繁体   English

RabbitMQ备份

[英]RabbitMQ Backup

In RabbitMQ management console, for import and export purpose, I saw this link Import / export definitions at the bottom of the Overview page. 在RabbitMQ管理控制台中,出于导入和导出的目的,我在Overview页面的底部看到了这个链接Import / export definitions。 But with this I am able to export the entire set of queues, exchanges etc. 但有了这个,我能够导出整个队列,交换等。

I am having an MQ server which contains the MQ setup of multiple applications. 我有一个MQ服务器,其中包含多个应用程序的MQ设置。 I would like to do a selective export of queues, exchanges etc of my application. 我想有选择地导出我的应用程序的队列,交换等。 Is it possible? 可能吗?

I don't think it's built in the tools provided. 我不认为它是在所提供的工具中构建的。 However, since the output is pure JSON, you can easily remove what is unnecessary. 但是,由于输出是纯JSON,因此您可以轻松删除不必要的内容。

Example: 例:

#!/usr/bin/python2.7

import json

dump = json.load(open("export.json"))

for k, v in dump.iteritems():
    if k == "queues":
        for i in reversed(range(len(v))):
            if v[i]["name"] not in ["QUEUE#0", "QUEUE#1"]:
                v.pop(i)
        break

open("export-updated.json", "w").write(json.dumps(dump))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM