首页 > 代码库 > RabbitMQ基本管理(下)

RabbitMQ基本管理(下)

      为了能够登陆RabbitMQ,必须创建RabbitMQ用户账号。

# rabbitmqctl add_user elite elite123
Creating user "elite" ...
...done.
# sudo rabbitmqctl set_user_tags elite  administrator
Setting tags for user "elite" to [administrator] ...
...done.

    修改默认guest账号的登陆密码:

# sudo rabbitmqctl change_password guest guest123
Changing password for user "guest" ...
...done.


    登陆rabbitmq后,呈现下面rabbitmq 管理控制台。

1.1.1  Exchange类型

    显示Server支持的exchange类型,使用下面命令:

# sudo rabbitmqctllist_exchanges
Listing exchanges ...
       direct
amq.direct      direct
amq.fanout      fanout
amq.headers     headers
amq.match       headers
amq.rabbitmq.log        topic
amq.rabbitmq.trace      topic
amq.topic       topic
...done.


 

1.1.2  开发

    展开有关RabbitMQ的开发工作前, 有必要创建一个账号和虚拟主机。

# sudo rabbitmqctl add_userrabbitmq-dev rabbitmq123
Creating user "rabbitmq-dev" ...
...done.
# sudo rabbitmqctl add_vhostrabbit-dev-vhost
Creating vhost "rabbit-dev-vhost" ...
...done.vhost rabbit-dev-vhost


    设置有关账号的访问权限,分别设置了elite和rabbitmq-dev两个用户。

# rabbitmqctl set_permissions -p rabbit-dev-vhost elite".*" ".*" ".*"
Setting permissions for user "elite" in vhost"rabbit-dev-vhost" ...
...done.
# rabbitmqctl set_permissions -p rabbit-dev-vhost rabbitmq-dev  ".*" ".*" ".*"
Setting permissions for user "rabbitmq-dev" in vhost"rabbit-dev-vhost" ...
...done.


    配置远程访问的用户,需要创建rabbitmq.config文件,配置用户elite,端口

5672。服务器配置,请查看我上期写的博客。

RabbitMQ基本管理(下)