为了可以登陆RabbitMQ,必须创建RabbitMQ用户账号。
# rabbitmqctl add_user elite elite123Creating user "elite" ......done.# sudo rabbitmqctl set_user_tags elite administratorSetting tags for user "elite" to [administrator] ......done.
改动默认guest账号的登录password:
# sudo rabbitmqctl change_password guest guest123Changing password for user "guest" ......done.
登陆rabbitmq后,呈现以下rabbitmq 管理控制台。
1.1.1 Exchange类型
显示Server支持的exchange类型。使用以下命令:
# sudo rabbitmqctllist_exchangesListing exchanges ... directamq.direct directamq.fanout fanoutamq.headers headersamq.match headersamq.rabbitmq.log topicamq.rabbitmq.trace topicamq.topic topic...done.
1.1.2 开发
展开有关RabbitMQ的开发工作前。 有必要创建一个账号和虚拟主机。
# sudo rabbitmqctl add_userrabbitmq-dev rabbitmq123Creating user "rabbitmq-dev" ......done.# sudo rabbitmqctl add_vhostrabbit-dev-vhostCreating 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,port
5672。server配置,请查看我上期写的博客。