command run as manager
启动监控管理器:rabbitmq-plugins enable rabbitmq_management
关闭监控管理器:rabbitmq-plugins disable rabbitmq_management
启动rabbitmq:rabbitmq-service start
关闭rabbitmq:rabbitmq-service stop
查看所有的队列:rabbitmqctl list_queues
清除所有的队列:rabbitmqctl reset
关闭应用:rabbitmqctl stop_app
启动应用:rabbitmqctl start_app
添加用户:rabbitmqctl add_user username password
分配角色:rabbitmqctl set_user_tags username administrator
新增虚拟主机:rabbitmqctl add_vhost vhost_name
将新虚拟主机授权给新用户:rabbitmqctl set_permissions -p vtest admin ".*" ".*" ".*"
角色说明
none 最小权限角色
management 管理员角色
policymaker 决策者
monitoring 监控
administrator 超级管理员
打开web管理端需要重启
rabbitmq-plugins enable rabbitmq_management
rabbitmqserver restart
Commands:
stop [
shutdown
stop_app
start_app
wait
reset
force_reset
rotate_logs
hipe_compile
join_cluster
cluster_status
change_cluster_node_type disc | ram
forget_cluster_node [--offline]
rename_cluster_node oldnode1 newnode1 [oldnode2] [newnode2 ...]
update_cluster_nodes clusternode
force_boot
sync_queue [-p
cancel_sync_queue [-p
purge_queue [-p
set_cluster_name name
add_user
delete_user
change_password
clear_password
authenticate_user
set_user_tags
list_users
add_vhost
delete_vhost
list_vhosts [
set_permissions [-p
clear_permissions [-p
list_permissions [-p
list_user_permissions
set_parameter [-p
clear_parameter [-p
list_parameters [-p
set_global_parameter
clear_global_parameter
list_global_parameters
set_policy [-p
clear_policy [-p
list_policies [-p
list_queues [-p
list_exchanges [-p
list_bindings [-p
list_connections [
list_channels [
list_consumers [-p
status
node_health_check
environment
report
eval
close_connection
trace_on [-p
trace_off [-p
set_vm_memory_high_watermark
set_vm_memory_high_watermark absolute
set_disk_free_limit
set_disk_free_limit mem_relative
encode [--decode] [
[--cipher
decode [
[--iterations
list_hashes
list_ciphers
The list_queues, list_exchanges and list_bindings commands accept an optional
virtual host parameter for which to display results. The default value is "/".
arguments, policy, pid, owner_pid, exclusive, exclusive_consumer_pid,
exclusive_consumer_tag, messages_ready, messages_unacknowledged, messages,
messages_ready_ram, messages_unacknowledged_ram, messages_ram,
messages_persistent, message_bytes, message_bytes_ready,
message_bytes_unacknowledged, message_bytes_ram, message_bytes_persistent,
head_message_timestamp, disk_reads, disk_writes, consumers,
consumer_utilisation, memory, slave_pids, synchronised_slave_pids, state].
auto_delete, internal, arguments, policy].
destination_name, destination_kind, routing_key, arguments].
peer_port, peer_host, ssl, ssl_protocol, ssl_key_exchange, ssl_cipher,
ssl_hash, peer_cert_subject, peer_cert_issuer, peer_cert_validity, state,
channels, protocol, auth_mechanism, user, vhost, timeout, frame_max,
channel_max, client_properties, recv_oct, recv_cnt, send_oct, send_cnt,
send_pend, connected_at].
user, vhost, transactional, confirm, consumer_count, messages_unacknowledged,
messages_uncommitted, acks_uncommitted, messages_unconfirmed, prefetch_count,
global_prefetch_count].
另外附加遇到的一个错误:
创建队列或者路由的时候 ACCESS_REFSED access to exchange...
开始没找到原因,各种重启之类的都不奏效,自己感觉也是权限原因,然后去看权限,也是有的,于是又各种重新打命令,都没有奏效。
惊了,怎么带上了单引号,原来是命令 rabbitmqctl set_permissions -p vhost_name username ".*" ".*" ".*" 敲成了 rabbitmqctl set_permissions -p vhost_name username ‘.*’ ‘.*’ ‘.*’,在网上查了很久没找到原因,算是个教训的吧,所以加上来防止后人入坑