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
firehose,rabbitmq_tracing插件
rabbitmq负载均衡