RabbitMq安装

系统环境


安装二郎神

因为RabbitMq是Erlang语言写的,因为需要先安装二郎

[root@localhost mq]# wget http://erlang.org/download/otp_src_19.3.tar.gz
[root@localhost mq]# tar -zxvf otp_src_19.3.tar.gz
[root@localhost otp_src_19.3]# ./configure --prefix=/opt/erlang

安装的过程中出现了如下的错误(图好像截小了)

这说明需要安装perl:yum install perl

yum install ncurses-devel

总之缺少什么装什么就对了...


安装RabbitMQ服务

 
  

[root@localhost mq]# wget http://www.rabbitmq.com/releases/rabbitmq-server/v3.6.10/rabbitmq-server-generic-unix-3.6.10.tar.xz
[root@localhost mq]# xz -d rabbitmq-server-generic-unix-3.6.10.tar.xz
//tar 命令的-C参数将文件解压到其他的目录
[root@localhost mq]# tar -zxvf rabbitmq-server-generic-unix-3.6.10.tar -C /opt

配置环境变量

[root@localhost mq]# vi /etc/profile
JAVA_HOME=/root/software/jdk1.8.0_161
JRE_HOME=/root/software/jdk1.8.0_161/jre
CLASS_PATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib
PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
export JAVA_HOME JRE_HOME CLASS_PATH PATH
ERLANG_HOME=/opt/erlang
export PATH=$PATH:$ERLANG_HOME/bin
export ERLANG_HOME
export PATH=$PATH:/opt/rabbitmq/sbin
export RABBITMQ_HOME=/opt/rabbitmq

生效配置文件

[root@localhost mq]# source /etc/profile


启动

//rabbitmq以守护进程的方式在后台运行
[root@localhost ebin]#rabbitmq-server &

防火墙中打开如下端口

firewall-cmd --zone=public --add-port=15672/tcp --permanent
firewall-cmd --zone=public --add-port=5672/tcp --permanent
firewall-cmd --reload

查看状态

[root@localhost rabbitmq]# rabbitmqctl status
Status of node rabbit@localhost
[{pid,1470},
{running_applications,
    [{rabbitmq_management,"RabbitMQ Management Console","3.6.10"},
     {rabbitmq_web_dispatch,"RabbitMQ Web Dispatcher","3.6.10"},
     {cowboy,"Small, fast, modular HTTP server.","1.0.4"},
     {rabbitmq_management_agent,"RabbitMQ Management Agent","3.6.10"},
     {rabbit,"RabbitMQ","3.6.10"},
     {ranch,"Socket acceptor pool for TCP protocols.","1.3.0"},
     {ssl,"Erlang/OTP SSL application","8.1.1"},
     {public_key,"Public key infrastructure","1.4"},
     {asn1,"The Erlang ASN1 compiler version 4.0.4","4.0.4"},
     {amqp_client,"RabbitMQ AMQP Client","3.6.10"},
     {rabbit_common,
         "Modules shared by rabbitmq-server and rabbitmq-erlang-client",
         "3.6.10"},
     {compiler,"ERTS  CXC 138 10","7.0.4"},
     {cowlib,"Support library for manipulating Web protocols.","1.0.2"},
     {xmerl,"XML parser","1.3.13"},
     {mnesia,"MNESIA  CXC 138 12","4.14.3"},
     {syntax_tools,"Syntax tools","2.1.1"},
     {inets,"INETS  CXC 138 49","6.3.6"},
     {os_mon,"CPO  CXC 138 46","2.4.2"},
     {crypto,"CRYPTO","3.7.3"},
     {sasl,"SASL  CXC 138 11","3.0.3"},
     {stdlib,"ERTS  CXC 138 10","3.3"},
     {kernel,"ERTS  CXC 138 10","5.2"}]},
{os,{unix,linux}},
{erlang_version,
    "Erlang/OTP 19 [erts-8.3] [source] [64-bit] [async-threads:64] [kernel-poll:true]\n"},
{memory,
    [{total,56137248},
     {connection_readers,0},
     {connection_writers,0},
     {connection_channels,0},
     {connection_other,2600},
     {queue_procs,43544},
     {queue_slave_procs,0},
     {plugins,1018752},
     {other_proc,19111336},
     {mnesia,64128},
     {metrics,56248},
     {mgmt_db,166920},
     {msg_index,42936},
     {other_ets,2342096},
     {binary,63440},
     {code,24774117},
     {atom,1033401},
     {other_system,7471378}]},
{alarms,[]},
{listeners,[{clustering,25672,"::"},{amqp,5672,"::"},{http,15672,"::"}]},
{vm_memory_high_watermark,0.4},
{vm_memory_limit,771506176},
{disk_free_limit,50000000},
{disk_free,3984068608},
{file_descriptors,
    [{total_limit,924},{total_used,4},{sockets_limit,829},{sockets_used,0}]},
{processes,[{limit,1048576},{used,329}]},
{run_queue,0},
{uptime,2150},
{kernel,{net_ticktime,60}}]

如果看到类似上面的信息表示:RabbitMq已正常启动


启用插件

rabbitmq-plugins enable rabbitmq_management

浏览器访问:http://10.252.22.210:15672/

RabbitMq安装_第1张图片

查看日志

意思是:guest用户只能在localhost下才能使用


这里我们新建一个用户:用rabbitmqctl这个命令

[root@localhost ~]# rabbitmqctl  add_user sky sky
[root@localhost ~]# rabbitmqctl set_permissions sky  ".*" ".*" ".*"
[root@localhost ~]# rabbitmqctl set_user_tags sky administrator

RabbitMq安装_第2张图片


到此小兔子就安装好了,下篇会带来amqp-client实现生产-消费的案例以及spring、springboot整合rabbitmq的Demo。


CSDN文章同步会慢些,欢迎关注微信公众号:挨踢男孩


    


你可能感兴趣的:(mq,RabbitMq,mq,Centos,Linux)