rabbitmq第一篇:rabbitmq安装详解(转载)

安装环境

虚拟机:VMware® Workstation 10.0.1 build

Linux系统:CentOS6.5

官方安装:http://www.rabbitmq.com/install-rpm.html

 

1、安装 Erlang

      1)Enable EPEL on your machine

      以root身份执行下面两行命令

[html]  view plain copy 在CODE上查看代码片 派生到我的代码片
 
  1. su -c 'rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm'  
  2. su -c 'yum install foo'  

 

      2)EnableErlang repository

      以root身份执行下面命令(保证安装最新版本epel)

[html]  view plain copy 在CODE上查看代码片 派生到我的代码片
 
  1. wget -O /etc/yum.repos.d/epel-erlang.repo http://repos.fedorapeople.org/repos/peter/erlang/epel-erlang.repo  

 

      3)Install  Erlang

      以root身份执行下面命令

[html]  view plain copy 在CODE上查看代码片 派生到我的代码片
 
  1. yum install erlang  

 

2、安装 rabbitmq-server

[html]  view plain copy 在CODE上查看代码片 派生到我的代码片
 
  1. rpm --import http://www.rabbitmq.com/rabbitmq-signing-key-public.asc  
  2. yum install rabbitmq-server-3.2.3-1.noarch.rpm(注:要下载下来)  

 

3、安装 RabbitMQWeb管理插件

     在终端执行如下命令即安装成功:

[html]  view plain copy 在CODE上查看代码片 派生到我的代码片
 
  1. rabbitmq-plugins enable rabbitmq_management  
  2. service rabbitmq-server restart  

 

打开浏览器登录:http://127.0.0.1:15672     55672也可以,直接跳转到下列web管理

登录 账号密码默认都是 guest

4、启动RabbitMQ Server

[html]  view plain copy 在CODE上查看代码片 派生到我的代码片
 
  1. /etc/init.d/rabbitmq-serverstart  
  2. 或  
  3. service rabbitmq-service start  

 

5、管理

Rabbitmq服务器的主要通过rabbitmqctl和rabbimq-plugins两个工具来管理,以下是一些常用功能。

1). 服务器启动与关闭

      启动: rabbitmq-server –detached

      关闭:rabbitmqctl stop

      若单机有多个实例,则在rabbitmqctlh后加–n 指定名称

2). 插件管理

      开启某个插件:rabbitmq-pluginsenable xxx

      关闭某个插件:rabbitmq-pluginsdisablexxx

      注意:重启服务器后生效。

3).virtual_host管理

      新建virtual_host: rabbitmqctladd_vhost  xxx

      撤销virtual_host:rabbitmqctl  delete_vhost xxx

4). 用户管理

      新建用户:rabbitmqctl add_user xxxpwd

      删除用户:   rabbitmqctl delete_user xxx

      改密码: rabbimqctlchange_password {username} {newpassword}

      设置用户角色:rabbitmqctlset_user_tags {username} {tag ...}

              Tag可以为 administrator,monitoring, management

5). 权限管理

      权限设置:set_permissions [-pvhostpath] {user} {conf} {write} {read}

               Vhostpath

               Vhost路径

               user

      用户名

              Conf

      一个正则表达式match哪些配置资源能够被该用户访问。

              Write

      一个正则表达式match哪些配置资源能够被该用户读。

               Read

      一个正则表达式match哪些配置资源能够被该用户访问。

6). 获取服务器状态信息

       服务器状态:rabbitmqctl status

       队列信息:rabbitmqctl list_queues[-p vhostpath] [queueinfoitem ...]

                Queueinfoitem可以为:name,durable,auto_delete,arguments,messages_ready,

                messages_unacknowledged,messages,consumers,memory

       Exchange信息:rabbitmqctllist_exchanges[-p vhostpath] [exchangeinfoitem ...]

                 Exchangeinfoitem有:name,type,durable,auto_delete,internal,arguments.

       Binding信息:rabbitmqctllist_bindings[-p vhostpath] [bindinginfoitem ...]       

                 Bindinginfoitem有:source_name,source_kind,destination_name,destination_kind,routing_key,arguments

       Connection信息:rabbitmqctllist_connections [connectioninfoitem ...]

       Connectioninfoitem有:recv_oct,recv_cnt,send_oct,send_cnt,send_pend等。

       Channel信息:rabbitmqctl  list_channels[channelinfoitem ...]

      Channelinfoitem有consumer_count,messages_unacknowledged,messages_uncommitted,acks_uncommitted,messages_unconfirmed,prefetch_count,client_flow_blocked

 

 

安装常见问题:

 

1、启动rabbitmq-server时,报错信息:Starting rabbitmq-server: FAILED - check /var/log/rabbitmq/startup_{log, _err}

       解决:使用netstat 查看是否存在,如果存在用kiss 将其杀死,在启动,我试过可以解决。

 

原文地址:http://blog.csdn.net/mlks_2008/article/details/18988301

猜你喜欢

转载自wb284551926.iteye.com/blog/2212112