rabbitmq / rabbitmq-server

Open source RabbitMQ: core server and tier 1 (built-in) plugins
https://www.rabbitmq.com/
Other
12.34k stars 3.92k forks source link

set_parameter failed to set for specific vhost #1446

Closed arouene closed 6 years ago

arouene commented 6 years ago

Hello,

Having problem to set a parameter with set_parameter for a specific vhost.

As stated by rabbitmqctl, we can use the -p vhost parameter.

Usage:
rabbitmqctl [-n <node>] [-t <timeout>] [-q] set_parameter [-p <vhost>] <component_name> <name> <value>

But while I'm using it, the parameter is listed in the default "/" vhost.

Steps to reproduce

# rabbitmqctl set_parameter -p prd federation-upstream node01 '{"uri":"amqp://user:password@server/prd","ack-mode":"on-publish","trust-user-id":true,"message-ttl":300000}'
Setting runtime parameter "federation-upstream" for component "node01" to "{"uri":"amqp://user:password@server/prd","ack-mode":"on-publish","trust-user-id":true,"message-ttl":300000}" ...
# rabbitmqctl list_parameters -p prd
Listing runtime parameters for vhost "prd" ...

# rabbitmqctl list_parameters
Listing runtime parameters for vhost "/" ...
federation-upstream     node01  {"ack-mode":"on-publish","message-ttl":300000,"trust-user-id":true,"uri":"amqp://user:password@server/prd"}

Infos

lukebakken commented 6 years ago

Thanks Aurélien for the detailed description. I can reproduce what you report and am investigating. It looks to be specific to set_parameter in rabbitmqctl

lukebakken commented 6 years ago

@shengis - this is definitely an issue with the rabbitmqctl command, so I opened rabbitmq/rabbitmq-cli#232

As a workaround, you should be able to execute this command:

rabbitmqctl eval 'J="{\"uri\":\"amqp://user:password@server/prd\",\"ack-mode\":\"on-publish\",\"trust-user-id\":true,\"message-ttl\":300000}", rabbit_runtime_parameters:parse_set(<<"prd">>, <<"federation-upstream">>, "node01", J, "guest").'

I ran that command and verified it:

$ rabbitmqctl list_parameters -p prd
Listing runtime parameters for vhost "prd" ...
federation-upstream     "node01"        {"ack-mode":"on-publish","message-ttl":300000,"trust-user-id":true,"uri":"amqp://user:password@server/prd"}
michaelklishin commented 6 years ago

As a workaround you can define federation upstreams using the federation-management plugin.

arouene commented 6 years ago

Thanks for the workarounds ! To be faire, I didn't tried to use the UI management. It's easier to use command line when using remote servers.