1.为了使用存储库,添加一个用于将RabByMQ版本发布到APT密钥的密钥:
In order to use the repository, add a key used to sign RabbitMQ releases to apt-key
2.添加相应版本的源
echo "deb https://dl.bintray.com/rabbitmq/debian xenial main" | sudo tee /etc/apt/sources.list.d/bintray.rabbitmq.list
3.更新源列表
sudo apt-get update
4.安装支持库
sudo apt-get install erlang erlang-nox -y
5.安装rabbitmq-server,并启动服务
sudo apt-get install rabbitmq-server -y/etc/init.d/rabbitmq-server start #安装完成默认是开启
6.启动插件
rabbitmq既可以命令行操作,也可以用rabbitmq自带的web管理界面,只需要启动插件便可以使用 sudo rabbitmq-plugins enable rabbitmq_management #默认端口15672
访问地址:http://127.0.0.1:15672
7.Rabbitmq-server默认端口
4369: epmd, a peer discovery service used by RabbitMQ nodes and CLI tools 5672, 5671: used by AMQP 0-9-1 and 1.0 clients without and with TLS 25672: used for inter-node and CLI tools communication (Erlang distribution server port) and is allocated from a dynamic range (limited to a single port by default, computed as AMQP port + 20000). Unless external connections on these ports are really necessary (e.g. the cluster uses federation or CLI tools are used on machines outside the subnet), these ports should not be publicly exposed. See networking guide for details. 35672-35682: used by CLI tools (Erlang distribution client ports) for communication with nodes and is allocated from a dynamic range (computed as server distribution port + 10000 through server distribution port + 10010). See networking guide for details. 15672: HTTP API clients, management UI and rabbitmqadmin (only if the management plugin is enabled) 61613, 61614: STOMP clients without and with TLS (only if the STOMP plugin is enabled) 1883, 8883: (MQTT clients without and with TLS, if the MQTT plugin is enabled 15674: STOMP-over-WebSockets clients (only if the Web STOMP plugin is enabled) 15675: MQTT-over-WebSockets clients (only if the Web MQTT plugin is enabled)
8.常用命令
sudo chkconfig rabbitmq-server on #添加开机启动(chkconfig一般只有redhat系统有)RabbitMQ服务 sudo service rabbitmq-server start # 启动服务 sudo service rabbitmq-server status # 查看服务状态 sudo service rabbitmq-server stop # 停止服务 sudo rabbitmqctl stop # 停止服务 sudo rabbitmqctl status # 查看服务状态 sudo rabbitmqctl list_users # 查看当前所有用户 sudo rabbitmqctl list_user_permissions guest # 查看默认guest用户的权限 sudo rabbitmqctl delete_user guest# 删掉默认用户(由于RabbitMQ默认的账号用户名和密码都是guest。为了安全起见, 可以删掉默认用户) sudo rabbitmqctl add_user username password # 添加新用户 sudo rabbitmqctl set_user_tags username administrator# 设置用户tag sudo rabbitmqctl set_permissions -p / username ".*" ".*" ".*" # 赋予用户默认vhost的全部操作权限 sudo rabbitmqctl list_user_permissions username # 查看用户的权限
本文章部分资料来源于这里,部分资料来源于官网
原文地址:https://www.cnblogs.com/Roobbin/p/9606041.html
时间: 2024-10-16 09:57:45