RabbitMQ:3.10.18
Erlang:25.2
//先执行下面的命令安装一些必要的依赖:
yum -y install make gcc gcc-c++ kernel-devel m4 ncurses-devel openssl-devel glibc-devel xmlto perl wget socat
安装包下载地址:http://erlang.org/download/
mkdir -p /usr/local/erlang
cd /usr/local/erlang
wget http://erlang.org/download/otp_src_25.2.tar.gz
tar -zxvf otp_src_25.2.tar.gz
cd otp_src_25.2
./configure --prefix=/usr/local/erlang
make && make install
vim /etc/profile
export PATH=$PATH:/usr/local/erlang/bin
source /etc/profile
erl
下载安装包:rabbitmq-server-generic-unix-3.10.18.tar.xz
mkdir -p /usr/local/rabbitmq
tar -xvf rabbitmq-server-generic-unix-3.10.18.tar.xz
vim /etc/profile
export PATH=$PATH:/usr/local/rabbitmq/rabbitmq_server-3.10.18/sbin
source /etc/profile
cd /usr/local/rabbitmq/rabbitmq_server-3.10.18/sbin/
./rabbitmq-server -detached # 方式一
./rabbitmq-server start # 方式二
./rabbitmq-plugins enable rabbitmq_management
cd /usr/local/rabbitmq/rabbitmq_server-3.10.18/sbin/
# 添加一个admin用户,并且密码是admin@123
./rabbitmqctl add_user admin admin@123
# 然后修改用户角色为管理员:
./rabbitmqctl set_user_tags admin administrator
# 最后给admin用户添加权限:
./rabbitmqctl set_permissions -p / admin ".*" ".*" ".*"
rabbitmqctl delete_user admin
rabbitmqctl change_password admin [Newpassword]
注意事项:IP地址是安装RabbitMQ所在服务器的IP地址
#查看rabbitmq状态
systemctl status rabbitmq-server
#启动rabbitmq
./rabbitmq-server -detached # 启动方式一
./rabbitmq-server start # 启动方式二
systemctl start rabbitmq-server
#停止rabbitmq
rabbitmqctl stop #停止方式一
systemctl stop rabbitmq-server
#重启rabbitmq
rabbitmq-server restart #重启方式一
# 根据版本号下载延迟插件
# 下载地址:https://www.rabbitmq.com/community-plugins.html
[root@localhost sbin]# cd /usr/local/rabbitmq/rabbitmq_server-3.10.18/plugins/
[root@localhost plugins]# rabbitmq-plugins enable rabbitmq_delayed_message_exchange
#停止rabbitmq
rabbitmqctl stop
#启动rabbitmq
./rabbitmq-server -detached
#重启rabbitmq
./rabbitmq-server restart
vi /etc/init.d/rabbitmq
#!/bin/sh
#
# chkconfig: 2345 80 05
# description: rabbitmq
# processname: rabbitmq
#RabbitMQ安装目录
export PATH=$PATH:/usr/local/erlang/bin
export HOME=/usr/local/rabbitmq/rabbitmq_server-3.10.18
case "$1" in
start)
echo "Starting RabbitMQ ..."
cd $HOME/sbin
./rabbitmq-server -detached
;;
stop)
echo "Stopping RabbitMQ ..."
cd $HOME/sbin/
./rabbitmqctl stop
;;
status)
echo "Status RabbitMQ ..."
cd $HOME/sbin/
./rabbitmqctl status
;;
restart)
echo "Restarting RabbitMQ ..."
$0 stop
$0 start
;;
*)
echo "Usage: $prog {start|stop|status|restart}"
;;
esac
exit 0
chmod 777 /etc/init.d/rabbitmq
chkconfig --add rabbitmq
chkconfig rabbitmq on
chkconfig --list rabbitmq
systemctl daemon-reload
service rabbitmq start
service rabbitmq status
service rabbitmq stop
service rabbitmq restart
reboot
vi /usr/lib/systemd/system/rabbitmq-server.service
systemctl enable rabbitmq-server
reboot
#查看rabbitmq状态
systemctl status rabbitmq-server
#启动rabbitmq
systemctl start rabbitmq-server
#停止rabbitmq
systemctl stop rabbitmq-server