Juju provides the ability to interact with our cluster without knowing the host IP addresses beforehand. One of the units of the
rabbitiq-server charm that’s been deploed is designated as the “leader”.
juju exec --unit <application>/leader syntax enables commands to be executed on the host itself. The connection information is resolved by Juju.
Remove the guest user account
RabbitMQ comes with a default user account,
guest with the password
guest. This should be removed from production environments.
$ juju exec --unit 'rabbitmqctl delete_user guest'
Add other user accounts
User accounts --in this case a
demo account–can be added with a similar command,
$ export RABBIT_PASSWORD=$(head -c20 /dev/urandom | hex)
$ juju exec --unit rabbitmq/leader "rabbitmqctl add_user demo $RABBIT_PASSWORD"
To add any user tags, provide them to the
rabbitmqctl set_user_tags command:
$ juju exec --unit rabbitmq/leader "rabbitmqctl set_user_tags demo administrator"