1.安装erlang
需要先安装erlang相关环境依赖
yum install -y make gcc gcc-c++ m4 openssl openssl-devel ncurses-devel unixODBC unixODBC-devel java java-devel
2.下载并安装erlang
地址:
创建目录:
mkdir erlang
配置编译:
./configure --prefix=/opt/erlang
编译并安装:
make && makeinstall
添加环境变量:
vim /etc/profile
新增路径:
export ERLANG_HOME=/opt/erlang
追加erlang目录:
PATH=$PATH:$ERLANG_HOME/bin:$SPATH
验证是否安装成功:
erl -version
3.下载rabbitmq:
或
4.开启管理页面插件
cd ./rabbitmq-3.8.16/sbin/
./rabbitmq-plugins enable rabbitmq_management
5.后台启动Rabbit
./rabbitmq-server -detached
6.关闭服务
./rabbitmqctl stop
7.启动应用
./rabbitmqctl start_app
8.关闭整个节点(包括应用)
./rabbitmqctl stop
9.关闭应用
./rabbitmqctl stop_app
10.查看当前账号
cd /opt/rabbitmq-3.8.16/sbin/
查看当前已有用户列表
./rabbitmqctl start_app
./rabbitmqctl list_users
11.添加管理员账号
./rabbitmqctl start_app
#添加用户
#rabbitmqctl add_user Username Password
./rabbitmqctl add_user admin admin
12.授予 admin 超级管理员权限
./rabbitmqctl set_user_tags admin administrator
13.防火墙开放端口
15672:管理页面端口,5672:消息队列通信端口
firewall-cmd --zone=public --add-port=5672/tcp --permanentfirewall-cmd --zone=public --add-port=15672/tcp --permanentfirewall-cmd --reload
14.开机自启动
1.进入init.d目录
cd /etc/init.d
2.创建服务文件
vim nginx
3.编写脚本
#!/bin/bash
#chkconfig: 2345 63 37
#description: rabbitmq service
#processname: rabbitmq-3.11.2
export PATH=$PATH:/opt/erlang/bin
export RABBITMQ_HOME=/opt/rabbitmq/rabbitmq_server-3.11.2
case $1 in
start)
$RABBITMQ_HOME/sbin/rabbitmq-server -detached
sleep 1
echo "rabbitmq is started"
;;
stop)
$RABBITMQ_HOME/sbin/rabbitmqctl stop
echo "rabbitmq is stopped"
;;
restart)
$RABBITMQ_HOME/sbin/rabbitmqctl stop
echo "rabbitmq is stopped"
sleep 1
$RABBITMQ_HOME/sbin/rabbitmq-server -detached
echo "rabbitmq is started"
;;
*)
echo "start|stop|restart"
;;
esac
exit 0
4.修改文件权限:
chmod 777 rabbitmq
5.添加或删除服务
添加:
chkconfig --add rabbitmq
删除:
chkconfig --del rabbitmq
6.启动、停止或重启服务
启动:
service rabbitmq start
停止:
service rabbitmq stop
重启:
service rabbitmq restart
7.设置开启或关闭开机启动
开启:
chkconfig rabbitmq on
关闭:
chkconfig rabbitmq off
8.查看es进程,验证是否已启动
ps -ef | grep rabbitmq
http://ip:15672
文章评论