`

rabbitmq 学习-5-server管理

阅读更多

RabbitMQ Server Administrator's Guide

http://www.rabbitmq.com/admin-guide.html#installation

 

1, Rabbitmq DB

第一次启动,会检查是否有数据库,没有则创建 一个db,存放在

C:\Documents and Settings\Administrator\Application Data\RabbitMQDB会存储关于uservirtual host,持久化消息等信息

此目录下有两个文件夹:dblog

并会使用到这些资源:

virtual host/

userguest/guest

guest会分配所有的权限到virtual host /

 

2, 命令行管理工具rabbitmqctl

Rabbitmqctlrabbitmq的一个命令行管理工具,它用来对某个机器上(host)的节点(node)进行管理,本机默认的node名称是”rabbit”hostname可以使用hostname –s查看

执行相关命令时,可明确指定一个节点,例如:

rabbitmqctl –n node_name@host_name add_user username password

这个命令将在指定的机器(host_name)的节点(node_name)上创建一个用户

在启动rabbitmq的时命令行中,可以查看到node名称

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

RabbitMQ 1.6.0 (AMQP 8-0)

Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial Technologies LLC., and R

abbit Technologies Ltd.

Licensed under the MPL.  See http://www.rabbitmq.com/

 

node        : rabbit@WWW-65592D80C4A       //这里就是node_name@host_name

log         : C:/Documents and Settings/Administrator/Application Data/RabbitMQ/

log/rabbit.log      //日志目录

sasl log    : C:/Documents and Settings/Administrator/Application Data/RabbitMQ/

log/rabbit-sasl.log  //日志目录

database dir: c:/Documents and Settings/Administrator/Application Data/RabbitMQ/

db/rabbit-mnesia   //db目录

 

starting database              ...done

starting core processes         ...done

starting recovery              ...done

starting persister              ...done

starting guid generator         ...done

starting builtin applications      ...done

starting TCP listeners           ...done

 

broker running

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

 

3, 查看node状态

rabbitmqctl -q status

输出:

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

[{running_applications,[{rabbit,"RabbitMQ","1.6.0"},

                        {mnesia,"MNESIA  CXC 138 12","4.4.10"},

                        {os_mon,"CPO  CXC 138 46","2.2.2"},

                        {sasl,"SASL  CXC 138 11","2.1.6"},

                        {stdlib,"ERTS  CXC 138 10","1.16.2"},

                        {kernel,"ERTS  CXC 138 10","2.13.2"}]},

 {nodes,['rabbit@WWW-65592D80C4A']},

 {running_nodes,['rabbit@WWW-65592D80C4A']}]

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

 

4, 关闭rabbitmq

rabbitmqctl stop      

直接关闭rabbitmq,关闭rabbitmq节点(elr进程也关掉了),需要通过rabbitmq-server 才能重新启动

 

rabbitmqctl stop_app

关闭rabbitmq应用程序,但是erl进行还在,可以通过rabbitmqctl start_app恢复

 

rabbitmqctl start_app

启动rabbitmq应用程序

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

E:\rabbitmq_server-1.6.0\sbin>rabbitmqctl stop_app

Stopping node 'rabbit@WWW-65592D80C4A' ...

...done.

 

E:\rabbitmq_server-1.6.0\sbin>rabbitmqctl stop

Stopping and halting node 'rabbit@WWW-65592D80C4A' ...

...done.

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

 

5, 查看rabbitmq状态

rabbitmqctl status
rabbitmqctl –q status

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Status of node 'rabbit@WWW-65592D80C4A' ...

[{running_applications,[{rabbit,"RabbitMQ","1.6.0"},

                        {mnesia,"MNESIA  CXC 138 12","4.4.10"},

                        {os_mon,"CPO  CXC 138 46","2.2.2"},

                        {sasl,"SASL  CXC 138 11","2.1.6"},

                        {stdlib,"ERTS  CXC 138 10","1.16.2"},

                        {kernel,"ERTS  CXC 138 10","2.13.2"}]},

 {nodes,['rabbit@WWW-65592D80C4A']},

 {running_nodes,['rabbit@WWW-65592D80C4A']}]

...done.

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

 

6, 重置rabbitmq

rabbitmqctl reset
rabbitmqctl force_reset
使用force_resetreset不同之外在于:它会无条件的重置rabbitmq,不管rabbitmq database state,和rabbitmq已经在集群环境中配置,这个命令应该在迫不得已的情况去使用
 
重置rabbitmq,会有以下影响:
1,从集群节点中删除
2,删除db数据,如user, vhost信息,持久化消息 
 
重置成功后,必须stop rabbitmq,例如使用:rabbitmqctl stop_app
 

7, 修改日志文件后缀名

rabbitmqctl rotate_logs suffix_name
修改日志文件后缀名,执行以后,可以马上看到log目录下创建了指定后缀的日志文件:

rabbit.log.rabbit.log

rabbit-sasl.log.rabbit.log

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

E:\rabbitmq_server-1.6.0\sbin>rabbitmqctl rotate_logs .rabbit.log

Rotating logs to files with suffix ".rabbit.log" ...

...done.

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

 

8, 集群管理

rabbitmqctl cluster clusternode ...

 

9, rabbitmqctl 所有命令:

Usage: rabbitmqctl [-q] [-n <node>] <command> [<arg> ...]

 

Available commands:

 

  stop      - stops the RabbitMQ application and halts the node

  stop_app  - stops the RabbitMQ application, leaving the node running

  start_app - starts the RabbitMQ application on an already-running node

  reset     - resets node to default configuration, deleting all data

  force_reset

  cluster <ClusterNode> ...

  status

  rotate_logs [Suffix]

  close_connection <ConnectionPid> <ExplanationString>

 

  add_user        <UserName> <Password>

  delete_user     <UserName>

  change_password <UserName> <NewPassword>

  list_users

 

  add_vhost    <VHostPath>

  delete_vhost <VHostPath>

  list_vhosts

 

  set_permissions   [-p <VHostPath>] <UserName> <Regexp> <Regexp> <Regexp>

  clear_permissions [-p <VHostPath>] <UserName>

  list_permissions  [-p <VHostPath>]

  list_user_permissions <UserName>

 

  list_queues    [-p <VHostPath>] [<QueueInfoItem> ...]

  list_exchanges [-p <VHostPath>] [<ExchangeInfoItem> ...]

  list_bindings  [-p <VHostPath>]

  list_connections [<ConnectionInfoItem> ...]

  list_channels [<ChannelInfoItem> ...]

  list_consumers [-p <VHostPath>]

 

Quiet output mode is selected with the "-q" flag. Informational

messages are suppressed when quiet mode is in effect.

 

<node> should be the name of the master node of the RabbitMQ

cluster. It defaults to the node named "rabbit" on the local

host. On a host named "server.example.com", the master node will

usually be rabbit@server (unless RABBITMQ_NODENAME has been set to

some non-default value at broker startup time). The output of hostname

-s is usually the correct suffix to use after the "@" sign.

 

The list_queues, list_exchanges and list_bindings commands accept an

optional virtual host parameter for which to display results. The

default value is "/".

 

<QueueInfoItem> must be a member of the list [name, durable,

auto_delete, arguments, pid, owner_pid, exclusive_consumer_pid,

exclusive_consumer_tag, messages_ready, messages_unacknowledged,

messages_uncommitted, messages, acks_uncommitted, consumers,

transactions, memory]. The default is to display name and (number of)

messages.

 

<ExchangeInfoItem> must be a member of the list [name, type, durable,

auto_delete, arguments]. The default is to display name and type.

 

The output format for "list_bindings" is a list of rows containing

exchange name, queue name, routing key and arguments, in that order.

 

<ConnectionInfoItem> must be a member of the list [pid, address, port,

peer_address, peer_port, state, channels, user, vhost, timeout,

frame_max, client_properties, recv_oct, recv_cnt, send_oct, send_cnt,

send_pend].  The default is to display user, peer_address, peer_port

and state.

 

<ChannelInfoItem> must be a member of the list [pid, connection,

number, user, vhost, transactional, consumer_count,

messages_unacknowledged, acks_uncommitted, prefetch_count]. The

default is to display pid, user, transactional, consumer_count,

messages_unacknowledged.

 

The output format for "list_consumers" is a list of rows containing,

in order, the queue name, channel process id, consumer tag, and a

boolean indicating whether acknowledgements are expected from the

consumer.

分享到:
评论

相关推荐

    rabbitmq-server-generic-unix-3.5.7.tar.rar下载,rabbitmq安装包

    - 解压后,将RabbitMQ的可执行文件移动到适当目录,如`/usr/local/`,并创建软链接以便于管理:`sudo mv rabbitmq_server-3.5.7 /usr/local/rabbitmq && sudo ln -s /usr/local/rabbitmq/sbin/rabbitmq-server /usr...

    rabbitmq-server-mac-standalone-3.5.3

    **RabbitMQ for Mac 安装指南** RabbitMQ 是一个开源的消息代理和队列服务器,广泛用于...同时,配合详细的安装手册,可以更好地理解和掌握RabbitMQ的使用,确保在本地开发环境中顺利地进行消息队列的实践和学习。

    rabbitmq-server-windows-3.6.10.zip

    RabbitMQ是一款开源的消息队列系统,主要用于处理异步任务和分布式系统中的消息传递。它基于AMQP(Advanced Message ...同时,不断学习和掌握相关的最佳实践,能帮助你更好地利用RabbitMQ构建高效、可靠的分布式系统。

    rabbitmq-server-3.8.3安装包

    5. **验证安装**:访问`http://localhost:15672`(或服务器IP地址),使用默认凭据(guest/guest)登录Web管理界面,查看RabbitMQ的状态。 6. **安全配置**:生产环境中,务必更改默认用户凭据,限制guest用户的...

    rabbitmq-server3.10.5

    在Windows上,可以通过下载像`rabbitmq-server3.10.5.exe`这样的安装程序来安装RabbitMQ。执行安装过程,配置必要的环境变量,并启动RabbitMQ服务。 4. **RabbitMQ管理控制台** 安装完成后,RabbitMQ提供了一个...

    rabbitmq-server-windows-3.6.16.zip

    5. **management**: RabbitMQ的Web管理界面,用于监控和管理节点、队列、用户和策略。 6. **rabbitmq-plugins.bat**: 用于管理RabbitMQ插件的脚本,例如启用或禁用插件。 7. **logs**和**data**目录:分别存储...

    rabbitmq-server-3.8.9.exe

    标题中的“rabbitmq-server-3.8.9.exe”指的是RabbitMQ服务器的3.8.9版本的可执行文件,这是一个基于Erlang语言构建的消息队列系统。RabbitMQ是一个开源的消息代理和队列服务器,它允许应用程序之间进行异步通信。...

    20210616最新版rabbitmq-server-3.8.17.exe

    学习RabbitMQ不仅涉及理论知识,还需要实践操作来熟悉其工作流程。使用RabbitMQ管理插件可以直观地查看和操作队列、交换机和绑定,这对于理解和调试系统非常有帮助。同时,了解如何编写RabbitMQ客户端代码(如Python...

    rabbitmq-server-3.8.3_for_windows.rar

    **正文** RabbitMQ是一种广泛使用的开源消息代理和队列服务器,它基于AMQP...这个"rabbitmq-server-3.8.3_for_windows.rar"压缩包为Windows用户提供了一个便捷的安装方式,帮助他们快速投身于RabbitMQ的学习和实践。

    rabbitmq-server-3.9.14

    10. **文档与社区**:RabbitMQ有一个活跃的社区和详尽的官方文档,帮助用户学习和解决问题。新版本的发布通常会伴随着文档的更新,以反映新功能和变化。 综上所述,RabbitMQ 3.9.14是一个重要的版本,它不仅提供了...

    Window-Rabbitmq服务 3.7.7版本

    可以通过命令`rabbitmq-server start`启动服务,`rabbitmq-server stop`来停止服务,或者在服务管理界面中手动操作。 7. **监控与日志**: RabbitMQ的日志默认位于`C:\ProgramData\RabbitMQ\log`目录,你可以定期...

    rabbitmq-server-3.7.3.zip

    为了更好地利用RabbitMQ,开发者需要学习AMQP协议、RabbitMQ的管理和监控、以及如何在各种编程语言中使用RabbitMQ客户端库。 总之,RabbitMQ-Server-3.7.3是微服务环境中不可或缺的一部分,它提供了一种高效、可靠...

    otp-win64-25.1.2 rabbitmq-server-3.11.2

    5. **RabbitMQ管理工具**: RabbitMQ提供了一个Web管理界面,可以用来监控服务器状态、查看和管理队列、exchange和binding。掌握如何使用这个工具,对于日常运维和故障排查非常有帮助。 6. **RabbitMQ与其他系统的...

    rabbitmq-server-generic-unix-3.7.6.tar.zip

    6. 配置完成后,可以通过Web管理界面(默认端口55672)监控和管理RabbitMQ,开启界面需要运行`./bin/rabbitmq-plugins enable rabbitmq_management`。 了解RabbitMQ的基本操作只是开始,深入学习还包括了解其插件...

    rabbitmq-server-3.8.9.zip

    RabbitMQ是一个开源的消息代理和队列服务器,它基于AMQP(Advanced Message Queuing Protocol)协议,被广泛用于处理分布式...通过深入学习和实践,开发者可以充分利用RabbitMQ的特性,提升系统的可扩展性和健壮性。

    rabbitmq3.4.1安装教程以及配套软件.zip

    **RabbitMQ 3.4.1 安装教程及配套软件详解** RabbitMQ 是一个基于 AMQP(Advanced Message Queuing Protocol)的开源消息代理和队列服务器,广泛...通过深入学习,你可以利用 RabbitMQ 实现高效的消息传递和任务处理。

    rabbitmq-server-3.7.5.zip

    5. **队列与交换机**:RabbitMQ的核心概念包括队列(Queue)、交换机(Exchange)和绑定(Binding)。源码揭示了它们的创建、删除和工作流程,以及各种路由策略如Direct、Fanout、Topic、Header等的实现。 6. **...

    macOS-rabbitmq_server-3.7.10.zip

    **正文** 本文将详细介绍如何在macOS系统上安装和配置RabbitMQ服务器,以及与之相关的Erlang环境。RabbitMQ是一个开源的消息代理和队列服务器,它基于AMQP...持续学习和实践,你将成为一名熟练的RabbitMQ管理员。

    RabbitMQ-3.6.8 安装包及安装教程

    提供的`RabbitMQ安装.docx`文档将深入解释整个过程,对于学习和实践RabbitMQ的安装与配置非常有帮助。通过熟练掌握RabbitMQ,你可以实现高效、可靠的系统间通信,提升整体架构的灵活性和稳定性。

    rabbitmq-keepalive-haproxy.tgz

    5. `erlang-21.2.6-1.el7.x86_64.rpm` 和 `rabbitmq-server-3.7.9-1.el7.noarch.rpm` - 这是Erlang和RabbitMQ的安装包,Erlang是RabbitMQ的运行时环境,而RabbitMQ服务器本身则依赖这个环境运行。 6. `haproxy-...

Global site tag (gtag.js) - Google Analytics