q3256 发表于 2017-7-5 12:50:13

rabbitMq使用(mac平台)

rabbitMq使用(mac平台)






  1.下载



wget http://www.rabbitmq.com/releases/rabbitmq-server/v3.5.3/rabbitmq-server-mac-standalone-3.5.3.tar.gz
解压得到rabbitmq_server-3.6.2/目录
将此目录拷贝到你自己的程序安装目录.我的mac上单独创建了一个/mysoft目录,专门放一些程序
拷贝完成后
Start the Server
    /mysoft/rabbitmq_server-3.6.2/sbin/rabbitmq-server
配置文件:
$RABBITMQ_HOME/etc/rabbitmq/rabbitmq-env.conf 这里是/mysoft/rabbitmq_server-3.6.2/etc/rabbitmq/rabbitmq-env.conf
$RABBITMQ_HOME/etc/rabbitmq/rabbitmq.config   这里是/mysoft/rabbitmq_server-3.6.2/etc/rabbitmq/rabbitmq.config
安装完成后需要将/usr/local/sbin添加到$PATH,可以将下面这两行加到~/.bash_profile或者~/.profile:
  # RabbitMQ Config
export PATH=$PATH:/usr/local/sbin
  2.启动





adeMacBook-Pro:rabbitmq_server-3.5.3 apple$ sbin/rabbitmq-server
RabbitMQ 3.5.3. Copyright (C) 2007-2014 GoPivotal, Inc.
####      Licensed under the MPL.See http://www.rabbitmq.com/
####
##########Logs: sbin/../var/log/rabbitmq/rabbit@adeMacBook-Pro.log
########      sbin/../var/log/rabbitmq/rabbit@adeMacBook-Pro-sasl.log
##########
Starting broker... completed with 0 plugins.

  3.状态查询





adeMacBook-Pro:rabbitmq_server-3.5.3 apple$ sbin/rabbitmqctl status
Status of node 'rabbit@adeMacBook-Pro' ...
[{pid,79602},
{running_applications,[{rabbit,"RabbitMQ","3.5.3"},
{mnesia,"MNESIACXC 138 12","4.12.5"},
{os_mon,"CPOCXC 138 46","2.3.1"},
{xmerl,"XML parser","1.3.7"},
{sasl,"SASLCXC 138 11","2.4.1"},
{stdlib,"ERTSCXC 138 10","2.4"},
{kernel,"ERTSCXC 138 10","3.2"}]},
{os,{unix,darwin}},

  4.可以通过rabbitmq-plugins list查看所有插件信息
  5.服务停止



1 tedzhou$ sudo rabbitmqctl stop
2 Stopping and halting node 'rabbit@zhoumingdeMacBook-Pro' ...
  命令行管理RabbitMQ明细:
    RabbitMQ提供了rabbitmqctl和rabbitmqadmin命令行管理工具,它们都是RabbitMQ的插件,可以通过rabbitmq-plugins list查看所有插件信息。rabbitmqctl的完整命令列表如下:
  stop [<pid_file>]
    stop_app
    start_app
    wait <pid_file>
    reset
    force_reset
    rotate_logs <suffix>
    join_cluster <clusternode> [--ram]
    cluster_status
    change_cluster_node_type disc | ram
    forget_cluster_node [--offline]
    update_cluster_nodes clusternode
    sync_queue queue
    cancel_sync_queue queue
    add_user <username> <password>
    delete_user <username>
    change_password <username> <newpassword>
    clear_password <username>
    set_user_tags <username> <tag> ...
    list_users
    add_vhost <vhostpath>
    delete_vhost <vhostpath>
    list_vhosts [<vhostinfoitem> ...]
    set_permissions [-p <vhostpath>] <user> <conf> <write> <read>
    clear_permissions [-p <vhostpath>] <username>
    list_permissions [-p <vhostpath>]
    list_user_permissions <username>
    set_parameter [-p <vhostpath>] <component_name> <name> <value>
    clear_parameter [-p <vhostpath>] <component_name> <key>
    list_parameters [-p <vhostpath>]
    set_policy [-p <vhostpath>] [--priority <priority>] [--apply-to <apply-to>]
<name> <pattern><definition>
    clear_policy [-p <vhostpath>] <name>
    list_policies [-p <vhostpath>]
    list_queues [-p <vhostpath>] [<queueinfoitem> ...]
    list_exchanges [-p <vhostpath>] [<exchangeinfoitem> ...]
    list_bindings [-p <vhostpath>] [<bindinginfoitem> ...]
    list_connections [<connectioninfoitem> ...]
    list_channels [<channelinfoitem> ...]
    list_consumers [-p <vhostpath>]
    status
    environment
    report
    eval <expr>
    close_connection <connectionpid> <explanation>
    trace_on [-p <vhost>]
    trace_off [-p <vhost>]
    set_vm_memory_high_watermark <fraction>
    start_app、stop_app分别是启动和停止RabbitMQ应用。其他的list_queues、list_exchanges等是显示RabbitMQ队列、RabbitMQ交换机信息。
    rabbitmqadmin的完整命令列表如下(Mac下安装好了就带了这个命令,Windows下貌似还需要从http://server-name:15672/cli/下载,并可能需要通过rabbitmq-plugins enable rabbitmq management启用这个插件):
  Usage
=====
rabbitmqadmin subcommand
where subcommand is one of:
Options
=======
--help, -h            show this help message and exit
--config=CONFIG, -c CONFIG
                        configuration file
--node=NODE, -N NODE    node described in the configuration file [default:
                        'default' only if configuration file is specified]
--host=HOST, -H HOST    connect to host HOST
--port=PORT, -P PORT    connect to port PORT
--vhost=VHOST, -V VHOST
                        connect to vhost VHOST [default: all vhosts for list,
                        '/' for declare]
--username=USERNAME, -u USERNAME
                        connect using username USERNAME
--password=PASSWORD, -p PASSWORD
                        connect using password PASSWORD
--quiet, -q            suppress status messages
--ssl, -s            connect with ssl
--ssl-key-file=SSL_KEY_FILE
                        PEM format key file for SSL
--ssl-cert-file=SSL_CERT_FILE
                        PEM format certificate file for SSL
--format=FORMAT, -f FORMAT
                        format for listing commands - one of [raw_json, long,
                        pretty_json, kvp, tsv, table, bash]
--sort=SORT, -S SORT    sort key for listing queries
--sort-reverse, -R      reverse the sort order
--depth=DEPTH, -d DEPTH
                        maximum depth to recurse for listing tables [default:
                        1]
--bash-completion      Print bash completion script
--version            Display version and exit
Display
=======
list users [<column>...]
list vhosts [<column>...]
list connections [<column>...]
list exchanges [<column>...]
list bindings [<column>...]
list permissions [<column>...]
list channels [<column>...]
list parameters [<column>...]
list queues [<column>...]
list policies [<column>...]
list nodes [<column>...]
show overview [<column>...]
Object Manipulation
===================
declare queue name=...
declare vhost name=...
declare user name=... password=... tags=...
declare exchange name=... type=...
declare policy name=... pattern=... definition=...
declare parameter component=... name=... value=...
declare permission vhost=... user=... configure=... write=... read=...
declare binding source=... destination=...
delete queue name=...
delete vhost name=...
delete user name=...
delete exchange name=...
delete policy name=...
delete parameter component=... name=...
delete permission vhost=... user=...
delete binding source=... destination_type=... destination=... properties_key=...
close connection name=...
purge queue name=...
Broker Definitions
==================
export <file>
import <file>
Publishing and Consuming
========================
publish routing_key=...
get queue=...
* If payload is not specified on publish, standard input is used
* If payload_file is not specified on get, the payload will be shown on
    standard output along with the message metadata
* If payload_file is specified on get, count must not be set
  4、Web界面管理RabbitMQ
  默认可以通过http://serverip:15672访问RabbitMQ的Web管理界面,默认用户名密码都是guest。(注意:RabbitMQ 3.0之前的版本默认端口是55672,下同)
  5、RabbitMQ提供的HTTP API接口
  RabbitMQ还提供了HTTP API接口,这样可以通过编程方式监控RabbitMQ的运行状态,HTTP API接口的地址为:http://serverip:15672/api/
页: [1]
查看完整版本: rabbitMq使用(mac平台)