赞
踩
操作系统:centos7
RabbitMq版本:3.8.4
关闭firewalld
禁用 SELinux ,修改 /etc/selinux/config
SELINUX=disabled
rabbitmq-server启动过程需要连接主机名,配置host解析,修改/etc/hosts,增加映射
先查看系统是否已有自带的jdk
rpm -qa |grep java
rpm -qa |grep jdk
rpm -qa |grep gcj
[root@localhost home]# rpm -qa |grep java
java-1.7.0-openjdk-headless-1.7.0.191-2.6.15.5.el7.x86_64
java-1.8.0-openjdk-headless-1.8.0.181-7.b13.el7.x86_64
python-javapackages-3.4.1-11.el7.noarch
java-1.8.0-openjdk-1.8.0.181-7.b13.el7.x86_64
tzdata-java-2018e-3.el7.noarch
javapackages-tools-3.4.1-11.el7.noarch
java-1.7.0-openjdk-1.7.0.191-2.6.15.5.el7.x86_64
如果没有输出信息,则说明系统没有安装。如果有输出信息,则执行下面的命令卸载
rpm -qa | grep java | xargs rpm -e --nodeps
[root@localhost home]# rpm -qa | grep java | xargs rpm -e --nodeps
[root@localhost home]# rpm -qa |grep java
[root@localhost home]#
下载jdk8安装文件
https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
拷贝到home目录
[root@localhost home]# cp /mnt/hgfs/winfolder/jdk-8u231-linux-x64.tar.gz /home
解压
[root@localhost home]# tar -zxf jdk-8u231-linux-x64.tar.gz
配置java环境变量
[root@localhost home]# vi /etc/profile
增加如下内容
JAVA_HOME=/home/jdk1.8.0_231
CLASSPATH=$JAVA_HOME/lib/
PATH=$PATH:$JAVA_HOME/bin
export PATH JAVA_HOME CLASSPATH
使配置立即生效
[root@localhost home]# source /etc/profile
查看jdk安装情况
RabbitMq的运行依赖erlang,需要先安装erlang
RabbitMq与erlang版本对应关系如下
https://www.rabbitmq.com/which-erlang.html
下载erlang
https://www.erlang.org/downloads/22.3
解压
[root@localhost]#tar -zxvf otp_src_22.3.tar.gz
编译安装erlang语言环境,设置编译目录为 /opt/erlang
[root@localhost otp_src_22.3]# ./configure --prefix=/opt/erlang --enable-hipe --enable-threads --enable-smp-support --enable-kernel-poll
安装
[root@localhost otp_src_22.3]# make
[root@localhost otp_src_22.3]# make install
配置环境变量
[root@localhost otp_src_22.3]# vi /etc/profile
增加如下内容
ER_HOME=/opt/erlang
PATH=$PATH:$ER_HOME/bin
export PATH ER_HOME
使环境变量生效
[root@localhost otp_src_22.3]# source /etc/profile
验证
在任意目录下输入 erl 命令,出现如下图,则 erlang 安装成功
[root@localhost otp_src_22.3]# yum install perl
[root@localhost otp_src_22.3]# yum install unixODBC.x86_64 unixODBC-devel.x86_64
[root@localhost otp_src_22.3]# yum install gtk3-devel.x86_64
[root@localhost otp_src_22.3]# yum install -y make gcc gcc-c++ kernel-devel m4 ncurses-devel openssl-devel unixODBC unixODBC-devel httpd python-simplejson
[root@localhost otp_src_22.3]# yum -y install glibc-devel make xmlto wget
[root@localhost otp_src_22.3]# yum install -y epel-release socat
[root@localhost otp_src_22.3]# yum install mesa *
[root@localhost otp_src_22.3]# yum install freeglut*
安装wxWidgets
[root@localhost]# wget https://netix.dl.sourceforge.net/project/wxwindows/3.0.1/wxWidgets-3.0.1.tar.bz2
[root@localhost]# bzip2 -dkv wxWidgets-3.0.1.tar.bz2
[root@localhost]# tar -xvf wxWidgets-3.0.1.tar
[root@localhost]# cd wxWidgets-3.0.1/
[root@localhost]# ./configure --with-opengl --enable-debug --enable-unicode
[root@localhost]# make && make install
下载安装包
https://github.com/rabbitmq/rabbitmq-server/releases/download/v3.8.4/rabbitmq-server-3.8.4-1.el7.noarch.rpm
导入秘钥
[root@localhost tools]# rpm --import https://www.rabbitmq.com/rabbitmq-release-signing-key.asc
安装
[root@localhost tools]# rpm -ivh --nodeps rabbitmq-server-3.8.4-1.el7.noarch.rpm
查看状态
[root@localhost tools]# systemctl status rabbitmq-server
启用插件
[root@localhost tools]# rabbitmq-plugins enable rabbitmq_management
查看插件列表
[root@localhost tools]# rabbitmq-plugins list
浏览器访问http://ip:15672/
默认用户guest/guest 只允许localhost登录
添加用户,后面两个参数分别是用户名和密码
[root@localhos]# rabbitmqctl add_user test 1234
添加权限
[root@localhos]# rabbitmqctl set_permissions -p / test ".*" ".*" ".*"
修改用户角色
[root@localhos]# rabbitmqctl set_user_tags test administrator
查看用户
[root@localhos]# rabbitmqctl list_users
Listing users ...
user tags
guest [administrator]
test [administrator]
用新用户登录
其它操作
rabbitmqctl delete_user Username #删除一个用户
rabbitmqctl change_password Username Newpassword #修改用户密码
rabbitmqctl list_users #查看当前用户列表
新增一个 virtual hos,区分业务
新增一个exchange 交换空间
新增 queue 队列
绑定exchange 和 queue
问题
启动rabbitmq的时候报找不到erlang
[root@ip-10-57-4-16 ~]# journalctl -xe -- Unit rabbitmq-server.service has failed. -- -- The result is failed. Jun 02 16:32:15 ip-10-57-4-16 systemd[1]: Unit rabbitmq-server.service entered failed state. Jun 02 16:32:15 ip-10-57-4-16 systemd[1]: rabbitmq-server.service failed. Jun 02 16:32:15 ip-10-57-4-16 polkitd[9590]: Unregistered Authentication Agent for unix-process:15885:295753 (system bus name :1.37, object path /org/fre Jun 02 16:32:25 ip-10-57-4-16 systemd[1]: rabbitmq-server.service holdoff time over, scheduling restart. Jun 02 16:32:25 ip-10-57-4-16 systemd[1]: Stopped RabbitMQ broker. -- Subject: Unit rabbitmq-server.service has finished shutting down -- Defined-By: systemd -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel -- -- Unit rabbitmq-server.service has finished shutting down. Jun 02 16:32:25 ip-10-57-4-16 systemd[1]: Starting RabbitMQ broker... -- Subject: Unit rabbitmq-server.service has begun start-up -- Defined-By: systemd -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel -- -- Unit rabbitmq-server.service has begun starting up. Jun 02 16:32:25 ip-10-57-4-16 rabbitmq-server[15915]: /usr/lib/rabbitmq/bin/rabbitmq-server: line 47: erl: command not found Jun 02 16:32:25 ip-10-57-4-16 systemd[1]: rabbitmq-server.service: main process exited, code=exited, status=127/n/a Jun 02 16:32:25 ip-10-57-4-16 rabbitmqctl[15927]: /usr/lib/rabbitmq/bin/rabbitmq-env: line 181: exec: erl: not found Jun 02 16:32:25 ip-10-57-4-16 systemd[1]: rabbitmq-server.service: control process exited, code=exited status=127 Jun 02 16:32:25 ip-10-57-4-16 systemd[1]: Failed to start RabbitMQ broker. -- Subject: Unit rabbitmq-server.service has failed
解决
[root@localhos]# vi /usr/lib/rabbitmq/bin/rabbitmq-server
增加如下内容
ER_HOME=/opt/erlang
PATH=$PATH:$ER_HOME/bin
export PATH ER_HOME
启动rabbitmq
[root@localhos]# systemctl restart rabbitmq-server
[root@localhos]# systemctl status rabbitmq-server
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。