rabbitmq实战指南

MQ消息队列中间件,P2P,PUB/SUB 生产者消费者模型
erlang中实现AMQP
1 安装配置
2 rabbitmqctl status
3 增加用户??
rabbitmqctl add_user root root 增加用户
rabbitmqctl set_permissions -p / root "." "." ".*"
rabbitmqctl set_user_tags root administrator

rabbitmqctl list_queues name messages_ready
D:持久化队列


vhost之间是绝对独立的
rabbitmqctl add_vhost vhost1
rabbitmqctl list_vhosts name tracing
rabbitmqctl trace_on
rabbitmqctl delete_vhost aa
rabbitmqctl set_permissions -p vhost user conf write read
rabbitmqctl set_permissions -p vhost1 root "." "." ".*"
rabbitmqctl clear_permissions -p vhosts root
rabbitmqctl list_permissions -p vhost1
rabbitmqctl list_vhosts -q -t xx

rabbitmqctl add_user username password
rabbitmqctl change_user username password
rabbitmqctl authenticate_user username password
rabbitmqctl delete_user username
rabbitmqctl list_users
rabbit默认的角色:tag
none,management:web policymaker:web,policy,parameter
monitoring, administrator:all
rabbitmqctl set_user_tags userename management,policymaker,monitoring

开启web管理端插件:
rabbitmq-plugins enable rabbitmq_management
rabbitmq-plugins list
web:http://ip:15672

用-detach启动的,没有pidfile
rabbitmqctl shutdown
rabbitmqctl stop_app
rabbitmqctl start_app
rabbitmqctl reset
rabbitmqctl force_reset
日志lunxun
rabbitmqctl rotate_logs .1

集群

rabbitmqctl cluster_status
rabbitmqctl stop_app
rabbitmqctl join_cluster rabbit@node2
rabbitmqctl start_app
rabbitmqctl set_cluster_name cluster_name

rabbitmqctl list_queues -p vhosts x1 x2 x3 ..

rabbitmqctl report > a.txt
./rabbitmqadmin --help


rabbitmq-env.conf 配置文件
NODENAME=
NODE_PORT=5672
CONFIG_FILE=/XXX
RABBITMQ_NODE_IP_ADDRESS
RABBITMQ_NODE_PORT 5672
RABBITMQ_DIST_PORT 25672
RABBITMQ_NODENAME
RABBITMQ_CONF_ENV_FILE
RABBITMQ_CONFIG_FILE #没有.config
RABBITMQ_MNESIA_BASE
RABBITMQ_MNESIA_DIR
RABBITMQ_LOG_BASE
RABBITMQ_LOGS
RABBITMQ_PLUGINS_DIR
----常用配置
CONFIG_FILE=/rabbitmq/rabbitmq
CONFIG_ENV_FILE=/rabbitmq/rabbitmq-env.conf
LOG_BASE=/rabbitmq/logs
MNESIA_BASE=/rabbitmq/mnesia

rabbitmqctl set_parameter -p vhost
rabbitmqctl list_parameters -p /
rabbitmqctl clear_parameter -p vhost
rabbitmqctl list_global_parameters

rabbitmqctl set_policy --apply-to exchanges --prority 1 p1


rabbitmq集群的搭建
节点的删除、添加、更新
--
rabbitmq单机多节点的配置
监控
rabbitmq 通过3种方式实现分布式部署:集群、federation、shovel


rabbitmq-plugins enable rabbitmq_federation
rabbitmq-plugins enable rabbitmq_federation_management

rabbitmq-plugins enable rabbitmq_shovel
rabbitmq-plugins enable rabbitmq_shovel_management

集群种erlang和rabbitmq的版本要一致
shovel和federation的版本可以随意


rabbitmq消息堆积处理
5672 25672

处理网络分区
配置自动处理网络分区:pause-minority ,autoheal


img_0bbacd7e1762533aac70ab5812004015.png
image.png

firehose,rabbitmq_tracing插件

rabbitmq负载均衡

Writing this book has been like discovering RabbitMQ itself—encountering a prob- lem that needed solving, but not knowing what the solution looked like. Until May 2010, we didn’t even know each other. We both had been active in the RabbitMQ com- munity for the past two years, but we’d never actually bumped into each other. Then one day a conversation with Alexis Richardson (Rabbit’s CEO at the time) introduced Alvaro and me to each other, and made what you hold in your hands possible. What we had in common was a desire to write down in a single place all the knowledge we had acquired about RabbitMQ the hard way. Back in 2010, that knowledge was (and today still largely is) scattered across the internet in a smattering of blog articles and terse technical tutorials. In other words, we both wanted to write the book we wished had existed when we started with RabbitMQ two years earlier. Neither of us came from a traditional messaging background, which made us fast friends and has largely informed the tone of RabbitMQ in Action; we wanted this book to be accessible for folks who’ve never heard of a queue or a binding before. In fact, when each of us discovered RabbitMQ, we didn’t even know what “messaging” was or that it was the solution to the problems we were having. My (Jason’s) situation was that my company needed a way to take the spam reportings we received from our custom- ers and process them out-of-band from our main stream of incoming messages. In Alvaro’s case, his company had a social network whose member communication sys- tem was creaking under the load of a 200 GB database. Like so many others who’ve come to messaging, both us had first tried to solve our queue-centric issues using data- base tables. Problems, like ensuring that only one application instance consumed any particular queue item, plagued our attempts at a database-driven solution and sent us looking for a better way. After all, we knew we couldn’t be the first people in the his- tory of software to have these issues. The solution for both of us came in a surprisingly similar way: a friend at Plaxo told me to check out this “RabbitMQ thing” as a way to solve my queue-centric problems, and an Erlang colleague of Alvaro’s in China gave him the same advice. Halfway around the world, both of us discovered RabbitMQ in the same way, and in response to trying to solve almost exactly the same problem! In fact, since you’re reading this book about RabbitMQ, it’s likely that similar challenges have led you to discover Rab- bitMQ in the same way. That speaks to the fact of why RabbitMQ is so popular: it eas- ily solves the basic problems of distributing data that each of us runs into again and again when trying to scale the software that we build. Our hope is that RabbitMQ in Action will help you design solutions to those chal- lenges more quickly and easily with RabbitMQ, so you can spend more time writing the software that will change the world and less time getting up to speed on the mes- saging broker that will help you do it. Perhaps, along the way, RabbitMQ will intro- duce you to an awesome coauthor who will become the lifelong friend you never expected. 1 This book is a product of how much we love writing software, and our hope is that it will help you do the same in ways you never thought possible. A LVARO V IDELA D ÜBENDORF , S WITZERLAND J ASON J. W. W ILLIAMS B OISE , I DAHO , U NITED S TATES
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值