RabbitMq-2安装与配置

Rabbitmq的安装

1.上传资源

RabbitMq-2安装与配置_第1张图片
注意:rabbitmq的版本必须与erlang编译器的版本适配
RabbitMq-2安装与配置_第2张图片
RabbitMq-2安装与配置_第3张图片

2.安装依赖环境

//打开虚拟机
yum install build-essential openssl openssl-devel unixODBC unixODBC-devel make gcc gcc-c++ kernel-devel m4 ncurses-devel tk tc xz

3.安装erlang

rpm -ivh erlang-18.3-1.el7.centos.x86_64.rpm

可能会出现以下的错误信息
在这里插入图片描述
说明gblic版本太低了,我们可以查看当前的gblic版本,这里需要2.15的版本,所以要进行更新升级

//查看当前的gblic的版本
strings /lib64/libc.so.6 | grep GLIBC
//更新安装依赖
 sudo yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc make -y
//更新或安装新的glibc组件。
wget http://copr-be.cloud.fedoraproject.org/results/mosquito/myrepo-el6/epel-6-x86_64/glibc-2.17-55.fc20/glibc-utils-2.17-55.el6.x86_64.rpm &
wget http://copr-be.cloud.fedoraproject.org/results/mosquito/myrepo-el6/epel-6-x86_64/glibc-2.17-55.fc20/glibc-static-2.17-55.el6.x86_64.rpm &
wget http://copr-be.cloud.fedoraproject.org/results/mosquito/myrepo-el6/epel-6-x86_64/glibc-2.17-55.fc20/glibc-2.17-55.el6.x86_64.rpm &
wget http://copr-be.cloud.fedoraproject.org/results/mosquito/myrepo-el6/epel-6-x86_64/glibc-2.17-55.fc20/glibc-common-2.17-55.el6.x86_64.rpm &
wget http://copr-be.cloud.fedoraproject.org/results/mosquito/myrepo-el6/epel-6-x86_64/glibc-2.17-55.fc20/glibc-devel-2.17-55.el6.x86_64.rpm &
wget http://copr-be.cloud.fedoraproject.org/results/mosquito/myrepo-el6/epel-6-x86_64/glibc-2.17-55.fc20/glibc-headers-2.17-55.el6.x86_64.rpm &
wget http://copr-be.cloud.fedoraproject.org/results/mosquito/myrepo-el6/epel-6-x86_64/glibc-2.17-55.fc20/nscd-2.17-55.el6.x86_64.rpm &

4.安装rabbitmq

//安装之前需要安装一个socat环境,即前面上传的资源
rpm -ivh socat-1.7.3.2-5.el7.lux.x86_64.rpm

如果出现以下错误,需要下载一个依赖包
tcp_wrappers 被 socat-1.7.3.2-1.1.el7.x86_64 需要

//下载包
yum install tcp_wrappers
//验证是否安装成功
rpm -q tcp_wrappers
//完成后再安装socat
//安装rabbitmq
rpm -ivh rabbitmq-server-3.6.5-1.noarch.rpm

RabbitMq-2安装与配置_第4张图片

5.rabbitmq的命令

RabbitMq-2安装与配置_第5张图片
运行mq的时候,出现以下错误

Starting rabbitmq-server (via systemctl): Job for rabbitmq-server.service failed because the control process exited with error code. See "systemctl status rabbitmq-server.service" and "journalctl -xe" for details.
解决方案:
解决办法:

禁用 SELinux ,修改 /etc/selinux/config
SELINUX=disabled
修改后重启系统
,重启系统,reboot

如果还是出现同样的情况的话,继续进行修改

进入文件进行编辑, vi /etc/hosts
按i编辑:
修改为:
主机ip enen enen.com
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6

按esc退出编辑,按:wq保存并退出

设置配置文件

cd /usr/share/doc/rabbitmq-server-3.6.5/

cp rabbitmq.config.example /etc/rabbitmq/rabbitmq.config

访问rabbitmq页面,RabbitMQ在安装好后,可以访问http://ip地址:15672 ;其自带了guest/guest的用户名和密码,3.以上的版本就必须自己创建用户了;如果需要创建自定义用户;那么也可以登录管理界面后,如下操作

//自创建用户的步骤
rabbitmqctl  add_user  admin  admin //创建用户	
rabbitmqctl  set_user_tags  admin administrator //设置权限 
service rabbitmq-server restart//重启服务

你可能感兴趣的:(rabbitmq,rabbitmq,分布式)