博客
关于我
CentOS8.1中RabbitMQ的安装
阅读量:473 次
发布时间:2019-03-06

本文共 4952 字,大约阅读时间需要 16 分钟。

  Linux软件包的安装方法有很多,RabbitMQ也不例外,这里记录一下强列推荐的安装方法!

  首先进入(https://www.rabbitmq.com/download.html),选择合适你的操作系统的下载和安装指引,我这边是CentOS(请确保你的服务器能连上外网,否则请用离线安装方式):

  进去后,我们根据说明,点进强列推荐的安装方式(即使用Package Cloud上的Yum库)的说明链接:

  由于Package Cloud签发安装包时使用的是他们自己的GPG key,虽然2018他们开始做Key迁移,但还是建设大家先导一下Package Cloud的Key:

  

# rpm --import https://packagecloud.io/rabbitmq/rabbitmq-server/gpgkey
# rpm --import https://packagecloud.io/gpg.key

  然后,因为RabbitMQ是由Erlang语言开发,RabbitMQ安装包也依赖于Erlang,所以我们先根据提示安装好Erlang相关的包:

# curl -s https://packagecloud.io/install/repositories/rabbitmq/erlang/script.rpm.sh | sudo bash

  然后再回过头来根据提示安装RabbitMQ:

# curl -s https://packagecloud.io/install/repositories/rabbitmq/rabbitmq-server/script.rpm.sh | sudo bash

  当然,以后有新版本了,你还可以用下面的命令将RabbitMQ更新到最新版本(生产环境不要随便更新升级哦!!!):

# yum install rabbitmq-server.noarch

  做完这些以后,安装工作可以说是完成了!是不是很快!但是,我们后面还得做一下基本配置的和验证的!

  安装完后,我们设置RabbitMQ为开机启动

# chkconfig rabbitmq-server on # systemctl enable rabbitmq-server.service

  然后我们在 /etc/rabbitmq/ 目录下新增一个环境配置文件 rabbitmq-env.conf 

# vim /etc/rabbitmq/rabbitmq-env.confNODENAME=rabbit@localhost

  接着尝试启动RabbitMQ服务:

# systemctl start rabbitmq-server

  最后查看一下RabbitMQ是否启动成功:

# rabbitmqctl statusError: unable to perform an operation on node 'rabbit@localhost'. Please see diagnostics information and suggestions below.Most common reasons for this are: * Target node is unreachable (e.g. due to hostname resolution, TCP connection or firewall issues) * CLI tool fails to authenticate with the server (e.g. due to CLI tool's Erlang cookie not matching that of the server) * Target node is not runningIn addition to the diagnostics info below: * See the CLI, clustering and networking guides on https://rabbitmq.com/documentation.html to learn more * Consult server logs on node rabbit@localhost * If target node is configured to use long node names, don't forget to use --longnames with CLI toolsDIAGNOSTICS===========attempted to contact: [rabbit@localhost]rabbit@localhost:  * connected to epmd (port 4369) on localhost  * epmd reports node 'rabbit' uses port 25672 for inter-node and CLI tool traffic   * TCP connection succeeded but Erlang distribution failed   * Node name (or hostname) mismatch: node "rabbit@mqserver" believes its node name is not "rabbit@mqserver" but something else.    All nodes and CLI tools must refer to node "rabbit@mqserver" using the same name the node itself uses (see its logs to find out what it is)Current node details: * node name: 'rabbitmqcli-33080-rabbit@localhost' * effective user's home directory: /var/lib/rabbitmq * Erlang cookie hash: V4dlxLzzzHnrAyZ80UrlSg==

  结果报错了!!!给出的可能原因的第一条是“Target node is unreachable (e.g. due to hostname resolution, TCP connection or firewall issues)”,目标节点不可达!所谡的目标节点,就是我们在 /etc/rabbitmq/rabbitmq-env.conf 文件中配置的 rabbit@localhost ,进于步推测的原因是hostname解析问题,或防火墙问题

  我们先试将localhost这个主机名做一个host映射(映射的IP 192.168.0.108是我的,你要换成你自己的):

# echo 192.168.0.108 localhost >> /etc/hosts

  完了后,重启一下RabbitMQ服务:

# systemctl restart rabbitmq-server

  再次查看一下RabbitMQ服务的状态(竟然好了,果然是hostname解析的问题):

# rabbitmqctl statusStatus of node rabbit@localhost ...RuntimeOS PID: 33539OS: LinuxUptime (seconds): 23RabbitMQ version: 3.8.7Node name: rabbit@localhostErlang configuration: Erlang/OTP 23 [erts-11.0.3] [source] [64-bit] [smp:2:2] [ds:2:2:10] [async-threads:64] [hipe]Erlang processes: 276 used, 1048576 limitScheduler run queue: 1Cluster heartbeat timeout (net_ticktime): 60PluginsEnabled plugin file: /etc/rabbitmq/enabled_pluginsEnabled plugins:Data directoryNode data directory: /var/lib/rabbitmq/mnesia/rabbit@localhostRaft data directory: /var/lib/rabbitmq/mnesia/rabbit@localhost/quorum/rabbit@localhostConfig filesLog file(s) * /var/log/rabbitmq/rabbit@localhost.log * /var/log/rabbitmq/rabbit@localhost_upgrade.logAlarms(none)MemoryTotal memory used: 0.0976 gbCalculation strategy: rssMemory high watermark setting: 0.4 of available memory, computed to: 0.7576 gbother_proc: 0.0295 gb (30.22 %)code: 0.0289 gb (29.62 %)reserved_unallocated: 0.0191 gb (19.61 %)other_system: 0.0126 gb (12.89 %)other_ets: 0.0029 gb (2.95 %)allocated_unused: 0.0023 gb (2.34 %)atom: 0.0013 gb (1.37 %)plugins: 0.0005 gb (0.47 %)metrics: 0.0002 gb (0.2 %)binary: 0.0002 gb (0.18 %)mnesia: 0.0001 gb (0.08 %)quorum_ets: 0.0 gb (0.05 %)msg_index: 0.0 gb (0.03 %)connection_channels: 0.0 gb (0.0 %)connection_other: 0.0 gb (0.0 %)connection_readers: 0.0 gb (0.0 %)connection_writers: 0.0 gb (0.0 %)mgmt_db: 0.0 gb (0.0 %)queue_procs: 0.0 gb (0.0 %)queue_slave_procs: 0.0 gb (0.0 %)quorum_queue_procs: 0.0 gb (0.0 %)File DescriptorsTotal: 2, limit: 32671Sockets: 0, limit: 29401Free Disk SpaceLow free disk space watermark: 0.05 gbFree disk space: 12.3948 gbTotalsConnection count: 0Queue count: 0Virtual host count: 1ListenersInterface: [::], port: 25672, protocol: clustering, purpose: inter-node and CLI tool communicationInterface: [::], port: 5672, protocol: amqp, purpose: AMQP 0-9-1 and AMQP 1.0

  至此使用官方推荐方法初步安装RabbitMQ就算完成了!

转载地址:http://devbz.baihongyu.com/

你可能感兴趣的文章
Nginx面试三连问:Nginx如何工作?负载均衡策略有哪些?如何限流?
查看>>
Nginx:NginxConfig可视化配置工具安装
查看>>
ngModelController
查看>>
ngrok | 内网穿透,支持 HTTPS、国内访问、静态域名
查看>>
NHibernate学习[1]
查看>>
NHibernate异常:No persister for的解决办法
查看>>
NIFI1.21.0_Mysql到Mysql增量CDC同步中_日期类型_以及null数据同步处理补充---大数据之Nifi工作笔记0057
查看>>
NIFI1.21.0_Mysql到Mysql增量CDC同步中_补充_更新时如果目标表中不存在记录就改为插入数据_Postgresql_Hbase也适用---大数据之Nifi工作笔记0059
查看>>
NIFI1.21.0_NIFI和hadoop蹦了_200G集群磁盘又满了_Jps看不到进程了_Unable to write in /tmp. Aborting----大数据之Nifi工作笔记0052
查看>>
NIFI1.21.0通过Postgresql11的CDC逻辑复制槽实现_指定表多表增量同步_增删改数据分发及删除数据实时同步_通过分页解决变更记录过大问题_02----大数据之Nifi工作笔记0054
查看>>
NIFI1.21.0通过Postgresql11的CDC逻辑复制槽实现_指定表或全表增量同步_实现指定整库同步_或指定数据表同步配置_04---大数据之Nifi工作笔记0056
查看>>
NIFI1.23.2_最新版_性能优化通用_技巧积累_使用NIFI表达式过滤表_随时更新---大数据之Nifi工作笔记0063
查看>>
NIFI从MySql中增量同步数据_通过Mysql的binlog功能_实时同步mysql数据_根据binlog实现数据实时delete同步_实际操作04---大数据之Nifi工作笔记0043
查看>>
NIFI从MySql中增量同步数据_通过Mysql的binlog功能_实时同步mysql数据_配置binlog_使用处理器抓取binlog数据_实际操作01---大数据之Nifi工作笔记0040
查看>>
NIFI从MySql中增量同步数据_通过Mysql的binlog功能_实时同步mysql数据_配置数据路由_实现数据插入数据到目标数据库_实际操作03---大数据之Nifi工作笔记0042
查看>>
NIFI从MySql中增量同步数据_通过Mysql的binlog功能_实时同步mysql数据_配置数据路由_生成插入Sql语句_实际操作02---大数据之Nifi工作笔记0041
查看>>
NIFI从MySql中离线读取数据再导入到MySql中_03_来吧用NIFI实现_数据分页获取功能---大数据之Nifi工作笔记0038
查看>>
NIFI从MySql中离线读取数据再导入到MySql中_无分页功能_02_转换数据_分割数据_提取JSON数据_替换拼接SQL_添加分页---大数据之Nifi工作笔记0037
查看>>
NIFI从PostGresql中离线读取数据再导入到MySql中_带有数据分页获取功能_不带分页不能用_NIFI资料太少了---大数据之Nifi工作笔记0039
查看>>
nifi使用过程-常见问题-以及入门总结---大数据之Nifi工作笔记0012
查看>>