centOS7 部署 rabbitMQ

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了centOS7 部署 rabbitMQ相关的知识,希望对你有一定的参考价值。

1、安装erlang 语言环境

#yum install ncurses-devel xmlto

#wget http://www.erlang.org/download/ otp_src_17.1.tar.gz
#tar zxvf  otp_src_17.1.tar.gz
#cd  otp_src_17.1
#./configure
#make && make install
安装完成以后,执行erl看是否能打开eshell,用’halt().’退出,注意后面的点号,那是erlang的结束符。

2、安装RabbitMQ

#wget http://www.rabbitmq.com/releases/rabbitmq-server/v3.3.4/rabbitmq-server-3.3.4.tar.gz
#tar zxvf rabbitmq-server-3.3.4.tar.gz
#cd rabbitmq-server-3.3.4
#make TARGET_DIR=/usr/rabbitmq SBIN_DIR=/usr/rabbitmq/sbin MAN_DIR=/usr/rabbitmq/man DOC_INSTALL_DIR=/usr/rabbitmq/doc
#make TARGET_DIR=/usr/rabbitmq SBIN_DIR=/usr/rabbitmq/sbin MAN_DIR=/usr/rabbitmq/man DOC_INSTALL_DIR=/usr/rabbitmq/doc  install

3、启动rabbitmq-server
# /usr/rabbitmq/sbin/rabbitmq-server  -detached

4、查看rabbitmq状态:
# /usr/rabbitmq/sbin/rabbitmqctl status
5、关闭rabbitmq:
# /usr/rabbitmq/sbin/rabbitmqctl stop

6、以下是简单维护
#开启管理页面插件
/usr/rabbitmq/sbin/rabbitmq-plugins enable rabbitmq_management

简单的rabbitmq配置可无需配置文件,只有需要定制复杂应用时,才需要用到配置文件

拷贝配置样例文件到etc下
cp /usr/rabbitmq/doc/rabbitmq.config.example /etc/rabbitmq/rabbitmq.conf


  tcp_listerners       #设置rabbimq的监听端口,默认为[5672]。
  disk_free_limit     #磁盘低水位线,若磁盘容量低于指定值则停止接收数据,默认值为{mem_relative, 1.0},即与内存相关联1:1,也可定制为多少byte.
   vm_memory_high_watermark    #设置内存低水位线,若低于该水位线,则开启流控机制,默认值是0.4,即内存总量的40%。
   hipe_compile     #将部分rabbimq代码用High Performance Erlang compiler编译,可提升性能,该参数是实验性,若出现erlang vm segfaults,应关掉。
   force_fine_statistics    #该参数属于rabbimq_management,若为true则进行精细化的统计,但会影响性能。
   frame_max     #包大小,若包小则低延迟,若包则高吞吐,默认是131072=128K。
   heartbeat     #客户端与服务端心跳间隔,设置为0则关闭心跳,默认是600秒。


查看RabbitMQ服务启动的状态,并开启RabbitMQ的相应管理插件

[[email protected] sbin]# ./rabbitmqctl status
Status of node [email protected] ...
[{pid,35112},
{running_applications,[{rabbit,"RabbitMQ","3.3.4"},
                        {os_mon,"CPO  CXC 138 46","2.2.15"},
                        {xmerl,"XML parser","1.3.7"},
                        {mnesia,"MNESIA  CXC 138 12","4.12.1"},
                        {sasl,"SASL  CXC 138 11","2.4"},
                        {stdlib,"ERTS  CXC 138 10","2.1"},
                        {kernel,"ERTS  CXC 138 10","3.0.1"}]},
{os,{unix,linux}},
{erlang_version,"Erlang/OTP 17 [erts-6.1] [source] [64-bit] [async-threads:30] [hipe] [kernel-poll:true]\n"},
{memory,[{total,35218336},
          {connection_procs,2728},
          {queue_procs,5456},
          {plugins,0},
          {other_proc,13339072},
          {mnesia,57552},
          {mgmt_db,0},
          {msg_index,33968},
          {other_ets,708832},
          {binary,30112},
          {code,16881166},
          {atom,654217},
          {other_system,3505233}]},
{alarms,[]},
{listeners,[{clustering,25672,"::"},{amqp,5672,"::"}]},
{vm_memory_high_watermark,0.4},
{vm_memory_limit,769332019},
{disk_free_limit,50000000},
{disk_free,45550653440},
{file_descriptors,[{total_limit,924},
                    {total_used,3},
                    {sockets_limit,829},
                    {sockets_used,1}]},
{processes,[{limit,1048576},{used,124}]},
{run_queue,0},
{uptime,2182}]
...done.
[[email protected] sbin]# ./rabbitmq-plugins list
[ ] amqp_client                       3.3.4
[ ] cowboy                            0.5.0-rmq3.3.4-git4b93c2d
[ ] eldap                             3.3.4-gite309de4
[ ] mochiweb                          2.7.0-rmq3.3.4-git680dba8
[ ] rabbitmq_amqp1_0                  3.3.4
[ ] rabbitmq_auth_backend_ldap        3.3.4
[ ] rabbitmq_auth_mechanism_ssl       3.3.4
[ ] rabbitmq_consistent_hash_exchange 3.3.4
[ ] rabbitmq_federation               3.3.4
[ ] rabbitmq_federation_management    3.3.4
[ ] rabbitmq_management               3.3.4
[ ] rabbitmq_management_agent         3.3.4
[ ] rabbitmq_management_visualiser    3.3.4
[ ] rabbitmq_mqtt                     3.3.4
[ ] rabbitmq_shovel                   3.3.4
[ ] rabbitmq_shovel_management        3.3.4
[ ] rabbitmq_stomp                    3.3.4
[ ] rabbitmq_test                     3.3.4
[ ] rabbitmq_tracing                  3.3.4
[ ] rabbitmq_web_dispatch             3.3.4
[ ] rabbitmq_web_stomp                3.3.4
[ ] rabbitmq_web_stomp_examples       3.3.4
[ ] sockjs                            0.3.4-rmq3.3.4-git3132eb9
[ ] webmachine                        1.10.3-rmq3.3.4-gite9359c7

运行如下的命令,增加用户admin,密码admin

[[email protected] sbin]# ./rabbitmqctl add_user admin admin
Creating user "admin" ...
...done.
[[email protected] sbin]# ./rabbitmqctl set_user_tags admin administraotr
Setting tags for user "admin" to [administraotr] ...
...done.
[[email protected] sbin]# ./rabbitmqctl list_users
Listing users ...
admin   [administraotr]
guest   [administrator]
...done.

本文出自 “linux_zhao” 博客,请务必保留此出处http://zhaoxiaolong.blog.51cto.com/9134845/1898572

以上是关于centOS7 部署 rabbitMQ的主要内容,如果未能解决你的问题,请参考以下文章

centos7部署jenkins

如何在centos7中部署Net6.0程序?

Centos7 安装部署 Airflow

centos7+nginx + php 部署多站点

centos7后台服务部署jar包

CentOS7下部署rsync服务