一种将 RabbitMQ 交换从一个虚拟主机迁移到另一个虚拟主机的方法
A way to migrate RabbitMQ exchanges from one vhost to another
在 RabbitMQ 中,是否有一种 easy/simple 方法可以将具有绑定和队列的自定义交换从一个 Vhost 迁移到另一个。 (Vhost:dev 到 Vhost:stage)
谢谢
因为版本 3.6.1
可以 Export/import config on virtual host level。
无法导出一个特定的 Exchange。
但您可以通过 HTTP API
获取 Exchange 定义
使用:
http://localhost:15672/api/exchanges/vhost/name/bindings/source
例如:
http://localhost:15672/api/exchanges/%2f/my_company/bindings/source
你会得到一个 json 像:
[
{
source: "my_company",
vhost: "/",
destination: "amq.gen-yZGNV22TwLcP3K-X69Yjyw",
destination_type: "queue",
routing_key: "#",
arguments: { },
properties_key: "%23"
},
{
source: "my_company",
vhost: "/",
destination: "my.queue",
destination_type: "queue",
routing_key: "#",
arguments: { },
properties_key: "%23"
}
]
在 RabbitMQ 中,是否有一种 easy/simple 方法可以将具有绑定和队列的自定义交换从一个 Vhost 迁移到另一个。 (Vhost:dev 到 Vhost:stage)
谢谢
因为版本 3.6.1
可以 Export/import config on virtual host level。
无法导出一个特定的 Exchange。
但您可以通过 HTTP API
使用:
http://localhost:15672/api/exchanges/vhost/name/bindings/source
例如:
http://localhost:15672/api/exchanges/%2f/my_company/bindings/source
你会得到一个 json 像:
[
{
source: "my_company",
vhost: "/",
destination: "amq.gen-yZGNV22TwLcP3K-X69Yjyw",
destination_type: "queue",
routing_key: "#",
arguments: { },
properties_key: "%23"
},
{
source: "my_company",
vhost: "/",
destination: "my.queue",
destination_type: "queue",
routing_key: "#",
arguments: { },
properties_key: "%23"
}
]