前言
好好学习
什么是RabbitMQ
RabbitMQ是支持持久化消息队列的消息中间件。应用在上下游的层次级业务逻辑中,上级业务逻辑相当于生产者发布消息,下级业务逻辑相当于消费者接受到消息并且消费消息。
安装erlang
1.安装依赖包
yum install ncurses-devel
2.安装erlang
yun install erlang
3.查看erlang安装的目录
[root@VM_0_11_centos mallSeckill]# whereis erlang
erlang: /usr/lib64/erlang
4.配置erlang环境变量,source /etc/profile
让配置生效。
#set erlang environment
ERLANG_HOME=/usr/lib64/erlang
PATH=$ERLANG_HOME/bin:$PATH
export ERLANG_HOME PATH
5.erl命令测试,安装成功。
[root@VM_0_11_centos mallSeckill]# erl
Erlang R16B03-1 (erts-5.10.4) [source] [64-bit] [async-threads:10] [hipe] [kernel-poll:false]
Eshell V5.10.4 (abort with ^G)
1>
安装RabbitMQ依赖
1.安装python
yum install python
2.安装Simplejson
yum install xmlto
yum install python-simplejson
解压命令
1.解压tar尾缀的压缩包
tar -xvf
2.解压xz尾缀的压缩包
xz -d
3.解压tar.gz尾缀的压缩包
tar -zxvf
4.解压zip尾缀的压缩包
unzip
安装RabbitMQ
1.解压压缩包
cd /usr/local/software
xz -d rabbitmq-server-generic-unix-3.6.14.tar.xz
tar -xvf rabbitmq-server-generic-unix-3.6.14.tar
mv rabbitmq_server-3.6.14/ /usr/local/rabbitmq
2.配置rabbitmq的环境,source /etc/profile
让其生效。
PATH=/usr/local/rabbitmq/sbin:$PATH
export PATH
3.启动rabbitmq,让其以后台守护进程方式启动。rabbitmq的端口号是5672
[root@VM_0_11_centos ~]# rabbitmq-server -detached
Warning: PID file not written; -detached was passed.
[root@VM_0_11_centos ~]# netstat -anp|grep 5672
tcp 0 0 0.0.0.0:25672 0.0.0.0:* LISTEN 12580/beam
tcp 0 1 172.16.0.11:35672 172.27.49.215:6379 SYN_SENT 12659/pnscan
tcp 0 1 172.16.0.11:56724 172.27.49.134:6379 SYN_SENT 12659/pnscan
tcp6 0 0 :::5672 :::* LISTEN
4.查看rabbitmq的状态
RabbitMQ网页插件配置
1.创建目录
[root@VM_0_11_centos ~]# mkdir /etc/rabbitmq
2.开启网页插件
[root@VM_0_11_centos ~]# rabbitmq-plugins enable rabbitmq_management
The following plugins have been enabled:
amqp_client
cowlib
cowboy
rabbitmq_web_dispatch
rabbitmq_management_agent
rabbitmq_management
Applying plugin configuration to rabbit@VM_0_11_centos... started 6 plugins.
3.配置防火墙,rabbitmq的端口是5672,rabbitmq网页端口是15672,然后service iptables restart
重启防火墙。
-A INPUT -p tcp -m state --state NEW -m tcp --dport 5672 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 15672 -j ACCEPT
4.访问rabbitmq网页
5.配置账号和权限。
rabbitmqctl add_user ${username} ${password}
rabbitmqctl set_permissions -p / ${username} ".*" ".*" ".*"
rabbitmqctl set_user_tags ${username} administrator
6.登录成功后,访问rabbitmq网页
尾言
天天向上,六一儿童节快乐。
我的博客即将搬运同步至腾讯云+社区,邀请大家一同入驻:https://cloud.tencent.com/developer/support-plan?invite_code=1upi0ld1pmjke