RabbitMQ基于Erlang开发,是一款实现了高级消息队列协议(AMQP)的开源消息代理软件。安装步骤具体如下:
安装 Erlang
为了安装方便,我们采用RabbitMQ团队提供的 Zero-dependency 64-bit Erlang RPM package来安装。
在rabbitmq/erlang on Package Cloud 中复制命令行。
- 创建erlang.repo仓库:
curl -s https://packagecloud.io/install/repositories/rabbitmq/erlang/script.rpm.sh | sudo bash
- 安装erlang:
yum install erlang
安装 RabbitMQ Server
在 PackageCloud中复制命令行。
- 创建rabbitmq-server.repo仓库:
curl -s https://packagecloud.io/install/repositories/rabbitmq/rabbitmq-server/script.rpm.sh | sudo bash
- 安装rabbitmq-server:
yum install rabbitmq-server
运行 RabbitMQ Server
- 设置开机默认启动rabbitmq-server守护进程:
# as an administrator run
chkconfig rabbitmq-server on
- 启动或停止rabbitmq服务:
# run as an administrator
service rabbitmq-server start
# or
service rabbitmq-server stop
- 启动管理插件(management plugin):
rabbitmq-plugins enable rabbitmq_management
管理插件提供一个web UI访问入口:http://localhost:15672/
注:这里需要在云服务器安全组里要打开端口15672
需要用到的端口:
- 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)