Ubuntu 18.04 Install RabbitMQ signing key curl -fsSL https://gi thub.com/rabbitmq/ signing-keys/releases/ download/2.0/ rabbitmq-release-signing-key.asc | sudo apt-key add -
Install apt HTTPS transport 1 sudo apt-get install apt-transport -https
Add Bintray repositories that provision latest RabbitMQ and Erlang 21.x releases 1 2 3 4 sudo tee /etc/ apt/sources.list.d/ bintray.rabbitmq.list <<EOF deb https:// dl.bintray.com/rabbitmq-erlang/ debian bionic erlang-21 .x deb https:// dl.bintray.com/rabbitmq/ debian bionic main EOF
Update package indices
Install rabbitmq-server and its dependencies 1 sudo apt-get install rabbitmq-server -y
启动服务
1 2 3 4 5 6 7 8 9 10 11 sudo service rabbitmq-server start sudo service rabbitmq-server stop sudo service rabbitmq-server restart sudo service rabbitmq-server status sudo ln -s /lib/ systemd/system/ rabbitmq-server.service /etc/ systemd/system/ rabbitmq-server.service
rabbitmq既可以命令行操作,也可以用rabbitmq自带的web管理界面,只需要启动插件便可以使用。
1 2 sudo rabbitmqctl start_app sudo rabbitmq-plugins enable rabbitmq_management
然后通过浏览器访问,如果是本机则可以输入http://127.0.0.1:15672打开登录界面,输入用户名和密码访问web管理界面了。默认用户名guest密码guest。 如果访问登录失败说明没有开启超级管理员登录。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 新建用户 sudo rabbitmqctl add_user admin passwd 赋予权限 sudo rabbitmqctl set_user_tags admin administrator 赋予virtual host中所有资源的配置、写、读权限以便管理其中的资源,也是添加远程访问权限 sudo rabbitmqctl set_permissions -p / admin '.*' '.*' '.*' 基本操作: sudo rabbitmqctl sudo rabbitmqctl stop sudo rabbitmqctl status sudo rabbitmqctl list_users sudo rabbitmqctl list_user_permissions guest sudo rabbitmqctl delete_user guest sudo rabbitmqctl add_user username password sudo rabbitmqctl set_user_tags username administrator sudo rabbitmqctl set_permissions -p / username ".*" ".*" ".*" sudo rabbitmqctl list_user_permissions username rabbitmqctl set_user_tags User TagUser 为用户名, Tag为角色名(对应于上面的administrator,monitoring,policymaker,management,或其他自定义名称)。 URL连接格式 CELERY_BROKER_URL=amqp://bs_whatweb:nbfuy7gh56@192.168 .199.149 :5672 /vhost_name
1 2 3 4 5 端口说明4369 5672 15672 25672