centos/rhel 6.5下rabbitmq安装(最简单方便的方式)

wget -c http://apt.sw.be/redhat/el5/en/x86_64/rpmforge/RPMS/rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm
yum install erlang
rpm -Uvh  rabbitmq-server-3.4.3-1.noarch.rpm
在命令敲rabbitmq-server。不会报command not found就OK了。
/etc/init.d/rabbitmq-server start

如果启动报:node with name "rabbit" already running on "mail"
vim /etc/rabbitmq/rabbitmq-env.conf
NODENAME=rabbit@localhost

NODE_IP_ADDRESS=127.0.0.1

--这两天新装机器,发现上述链接失效了。下面使用下载版erl安装,亲测,如下:

从https://www.erlang-solutions.com/resources/download.html下载R16B03版本的erlang。

rpm ivh esl-erlang_16.b.3-1~centos~6_amd64.rpm

export ERL_HOME=/usr/local/erlang

PATH=$RABBITMQ_HOME/sbin:$ERL_HOME/bin:$JAVA_HOME/bin:$PATH:$HOME/bin

安装完成后,输入erl看是否跳出交互界面,如下:

[root@dev-server local]# 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>

为了最方便不易出错,使用unix-generic.tar.gz通用版,不用rpm和源码。

从http://www.rabbitmq.com/releases/rabbitmq-server/v3.5.7/下载rabbitmq-server-generic-unix-3.5.7.tar.gz

tar xzvf rabbitmq-server-generic-unix-3.5.7.tar.gz

ln -s rabbitmq_server-3.5.7/ rabbitmq

export RABBITMQ_HOME=/usr/local/rabbitmq

启动rabbitmq

[root@dev-server ~]# rabbitmq-server

RabbitMQ 3.5.7. Copyright (C) 2007-2015 Pivotal Software, Inc.
  ##  ##      Licensed under the MPL.  See http://www.rabbitmq.com/
  ##  ##
  ##########  Logs: /usr/local/rabbitmq/sbin/../var/log/rabbitmq/rabbit@dev-server.log
  ######  ##        /usr/local/rabbitmq/sbin/../var/log/rabbitmq/rabbit@dev-server-sasl.log
  ##########
              Starting broker...

查看rabbitmq状态:

[root@dev-server ~]# rabbitmqctl status
Status of node 'rabbit@dev-server' ...
[{pid,53837},
 {running_applications,[{rabbit,"RabbitMQ","3.5.7"},
                        {os_mon,"CPO  CXC 138 46","2.2.14"},
                        {xmerl,"XML parser","1.3.6"},
                        {mnesia,"MNESIA  CXC 138 12","4.11"},
                        {sasl,"SASL  CXC 138 11","2.3.4"},
                        {stdlib,"ERTS  CXC 138 10","1.19.4"},
                        {kernel,"ERTS  CXC 138 10","2.16.4"}]},
 {os,{unix,linux}},
 {erlang_version,"Erlang R16B03-1 (erts-5.10.4) [source] [64-bit] [async-threads:64] [hipe] [kernel-poll:true]\n"},
 {memory,[{total,34723952},
          {connection_readers,0},
          {connection_writers,0},
          {connection_channels,0},
          {connection_other,2728},
          {queue_procs,2728},
          {queue_slave_procs,0},
          {plugins,0},
          {other_proc,13324200},
          {mnesia,57456},
          {mgmt_db,0},
          {msg_index,42504},
          {other_ets,704840},
          {binary,13944},
          {code,16499289},
          {atom,602729},
          {other_system,3473534}]},
 {alarms,[]},
 {listeners,[{clustering,25672,"::"},{amqp,5672,"::"}]},
 {vm_memory_high_watermark,0.4},
 {vm_memory_limit,784151347},
 {disk_free_limit,50000000},
 {disk_free,31549009920},
 {file_descriptors,[{total_limit,924},
                    {total_used,3},
                    {sockets_limit,829},
                    {sockets_used,1}]},
 {processes,[{limit,1048576},{used,123}]},
 {run_queue,0},
 {uptime,86}]

启用控制台

[root@dev-server ~]# rabbitmq-plugins enable rabbitmq_management
The following plugins have been enabled:
  mochiweb
  webmachine
  rabbitmq_web_dispatch
  amqp_client
  rabbitmq_management_agent
  rabbitmq_management

Applying plugin configuration to rabbit@dev-server... started 6 plugins.

在某些情况下,可能会出现如下错误:

Error: The following plugins could not be found:
  rabbitmq_management

此时是因为rabbitmq查找插件的路径不正确所致。可按照如下方式解决:

mkdir /etc/rabbitmq

vi /etc/rabbitmq/rabbitmq-env.conf    #这个是rabbitmq环境变量的配置文件,这个文件的位置是确定和不能改变的,位于:/etc/rabbitmq或$RABBITMQ_HOME/etc/rabbitmq目录下(视具体的安装方式而定),具体可参考http://www.rabbitmq.com/configure.html

增加如下配置项:

RABBITMQ_MNESIA_BASE=/usr/local/rabbitmq/data
RABBITMQ_LOG_BASE=/usr/local/rabbitmq/log
RABBITMQ_PLUGINS_DIR=/usr/local/rabbitmq/plugins

重启rabbitmq,问题解决。

PS:rabbitmq的标准配置文件是rabbitmq.config,它既有默认的目录,也可以在rabbitmq-env.conf文件中配置。,具体可参考http://www.rabbitmq.com/configure.html

rabbitmq对erlang的版本要求如下:

centos/rhel 6.5下rabbitmq安装(最简单方便的方式)

注:如果windows下报 node with name "rabbit" already running on XXX,则先执行rabbitmqctl.bat stop,再启动即可。

上一篇:Spring笔记——Spring+JDBC组合开发


下一篇:[转载]关于AutoCAD.NET的辅助方法