RabbitMQ : Install rabbitmqadmin2022/07/14 |
It's possible to configure RabbitMQ to use rabbitmqadmin command.
|
|
[1] | Download [rabbitmqadmin] on Web UI (for how to enable Web UI, refer to here). Login to Web UI and move to [(hostname or IP address):15672/cli], then following screen is shown, you can download [rabbitmqadmin] on here. |
[2] | Upload [rabbitmqadmin] to RabbitMQ Server and set suitable permissions. On this example, it sets like follows. |
[root@dlp ~]# ll /usr/local/bin/rabbitmqadmin -rwxr-xr-x. 1 root root 42225 Nov 23 2021 /usr/local/bin/rabbitmqadmin |
[3] | This is the basic usage for [rabbitmqadmin] command. |
# show sub-commands list # for options list, input [help] only [root@dlp ~]# rabbitmqadmin help subcommands Usage ===== rabbitmqadmin [options] subcommand where subcommand is one of: Display ======= list connections [<column>...] ..... ..... # show user list [root@dlp ~]# rabbitmqadmin list users +-------------+--------------------------------+--------------------------------------------------+---------------+ | name | hashing_algorithm | password_hash | tags | +-------------+--------------------------------+--------------------------------------------------+---------------+ | guest | rabbit_password_hashing_sha256 | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx | administrator | | serverworld | rabbit_password_hashing_sha256 | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx | administrator | +-------------+--------------------------------+--------------------------------------------------+---------------+ # show virtualhost list [root@dlp ~]# rabbitmqadmin list vhosts +-----------+----------+ | name | messages | +-----------+----------+ | / | | | /my_vhost | | +-----------+----------+ # add user [root@dlp ~]# rabbitmqadmin declare user name=redhat password=password tags=administrator user declared # add virtualhost [root@dlp ~]# rabbitmqadmin declare vhost name=/vhost01 vhost declared # grant permission [root@dlp ~]# rabbitmqadmin declare permission vhost=/vhost01 user=redhat configure=".*" write=".*" read=".*" permission declared # add queue [root@dlp ~]# rabbitmqadmin -V /vhost01 -u redhat -p password declare queue name=my_queue01 queue declared # send message [root@dlp ~]# rabbitmqadmin -V /vhost01 -u redhat -p password publish routing_key=my_queue01 payload='Hello RabbitMQ World!' exchange=amq.default Message published # receive message [root@dlp ~]# rabbitmqadmin -V /vhost01 -u redhat -p password get queue=my_queue01 +-------------+----------+---------------+-----------------------+---------------+------------------+------------+-------------+ | routing_key | exchange | message_count | payload | payload_bytes | payload_encoding | properties | redelivered | +-------------+----------+---------------+-----------------------+---------------+------------------+------------+-------------+ | my_queue01 | | 0 | Hello RabbitMQ World! | 21 | string | | False | +-------------+----------+---------------+-----------------------+---------------+------------------+------------+-------------+ |
Sponsored Link |