简体   繁体   中英

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. 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. 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.

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))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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