Export/Import rabbitMQ definitions in CLI

3,271 views
Skip to first unread message

Chinmaya Patnaik

unread,
Mar 18, 2017, 4:32:50 AM3/18/17
to rabbitmq-users
Hi,

Will the below export definitions step work ?

Export definitions:
curl -u username:password -X GET http://127.0.0.1:15672/api/definitions > rabbit_hostname_2017-3-18.json

If yes how will I import it to another rabbitMQ server ?
Import definitions: ?

I know in console its very simple (just download and upload definitions) but I need to know in CLI to keep the queues, exchanges, permissions, etc in sync without cluster set up. 

Thanks
Chinmaya Patnaik


Michael Klishin

unread,
Mar 18, 2017, 4:40:04 AM3/18/17
to rabbitm...@googlegroups.com, Chinmaya Patnaik
Why don't you try it instead of asking if it's going to work?

Definitions can either be loaded on node startup or via another HTTP API endpoint (I recommend
the latter option in case you use Shovel or Federation). See "Load Definitions at Startup"
in http://www.rabbitmq.com/management.html and https://rawcdn.githack.com/rabbitmq/rabbitmq-management/rabbitmq_v3_6_8/priv/www/api/index.html.

There are HTTP API libraries available for several popular languages and I believe
at least Java, Ruby and Go ones support definitions import.
> --
> You received this message because you are subscribed to the Google Groups "rabbitmq-users"
> group.
> To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-user...@googlegroups.com.
> To post to this group, send an email to rabbitm...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

--
MK

Staff Software Engineer, Pivotal/RabbitMQ


Michael Klishin

unread,
Mar 18, 2017, 4:41:08 AM3/18/17
to rabbitm...@googlegroups.com, Chinmaya Patnaik
Ah, and `rabbitmqadmin` has commands for that:
http://www.rabbitmq.com/management-cli.html

Chinmaya Patnaik

unread,
Mar 18, 2017, 6:37:25 AM3/18/17
to rabbitmq-users, chink...@gmail.com
Hi,

Yes the below command for exporting definitions works fine.
Export definitions: 
curl -u username:password -X GET http://127.0.0.1:15672/api/definitions > rabbit_hostname_2017-3-18.json 

So suppose I copy that json file to another rabbitMQ server and execute the below command it should import the configs. I doubt the syntax, it that fine? 
Import definitions:
curl -u username:password -X POST -H "content-type:application/json" -d @rabbit_hostname_2017-3-18.json \ http://127.0.0.1:15672/api/definitions

Thanks!
Chinmaya Patnaik

Michael Klishin

unread,
Mar 18, 2017, 10:58:59 AM3/18/17
to rabbitm...@googlegroups.com, chink...@gmail.com
That looks correct but I don't remember every curl flag off the top of my head so please test it out before deploying ;)

To post to this group, send email to rabbitm...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
--
Staff Software Engineer, Pivotal/RabbitMQ
Reply all
Reply to author
Forward
Message has been deleted
0 new messages