rabbitmq安装

1. 安装erlang

yum -y install make gcc gcc-c++ kernel-devel m4 ncurses-devel openssl-devel unixODBC-devel

https://github.com/rabbitmq/erlang-rpm

# cat > /etc/yum.repos.d/rabbitmq_erlang.repo << EOF
[rabbitmq-erlang]
name=rabbitmq-erlang
baseurl=https://dl.bintray.com/rabbitmq-erlang/rpm/erlang/22/el/7
gpgcheck=1
gpgkey=https://dl.bintray.com/rabbitmq/Keys/rabbitmq-release-signing-key.asc
repo_gpgcheck=0
enabled=1
EOF

yum install erlang

验证

# erl

2. 安装rabbitmq

下载

https://www.rabbitmq.com/download.html

下载了centos7的rabbitmq-server-3.7.17-1.el7.noarch.rpm

yum install socat

rpm -ivh rabbitmq-server-3.7.17-1.el7.noarch.rpm

将本机ip hostname写入/etc/hosts

# rabbitmq-server -detached

# rabbitmqctl status
Status of node rabbit@mhc-linux ...
[{pid,18289},
 {running_applications,
     [{rabbit,"RabbitMQ","3.7.17"},
      {sysmon_handler,"Rate-limiting system_monitor event handler","1.1.0"},
      {os_mon,"CPO  CXC 138 46","2.4.7"},
      {rabbit_common,
          "Modules shared by rabbitmq-server and rabbitmq-erlang-client",
          "3.7.17"},
      {ranch,"Socket acceptor pool for TCP protocols.","1.7.1"},
      {ssl,"Erlang/OTP SSL application","9.1"},
      {public_key,"Public key infrastructure","1.6.4"},
      {asn1,"The Erlang ASN1 compiler version 5.0.8","5.0.8"},
      {crypto,"CRYPTO","4.4"},
      {mnesia,"MNESIA  CXC 138 12","4.15.5"},
      {observer_cli,"Visualize Erlang Nodes On The Command Line","1.5.0"},
      {stdout_formatter,
          "Tools to format paragraphs, lists and tables as plain text",
          "0.2.2"},
      {jsx,"a streaming, evented json parsing toolkit","2.9.0"},
      {inets,"INETS  CXC 138 49","7.0.3"},
      {xmerl,"XML parser","1.3.18"},
      {recon,"Diagnostic tools for production use","2.5.0"},
      {lager,"Erlang logging framework","3.6.10"},
      {goldrush,"Erlang event stream processor","0.1.9"},
      {compiler,"ERTS  CXC 138 10","7.3"},
      {syntax_tools,"Syntax tools","2.1.6"},
      {sasl,"SASL  CXC 138 11","3.3"},
      {stdlib,"ERTS  CXC 138 10","3.7"},
      {kernel,"ERTS  CXC 138 10","6.2"}]},
 {os,{unix,linux}},
 {erlang_version,
     "Erlang/OTP 21 [erts-10.2] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:64] [hipe] "},
 {memory,
     [{connection_readers,0},
      {connection_writers,0},
      {connection_channels,0},
      {connection_other,0},
      {queue_procs,0},
      {queue_slave_procs,0},
      {plugins,11916},
      {other_proc,24206832},
      {metrics,195292},
      {mgmt_db,0},
      {mnesia,72512},
      {other_ets,2524648},
      {binary,188384},
      {msg_index,28848},
      {code,20864784},
      {atom,1090753},
      {other_system,11592639},
      {allocated_unused,10395488},
      {reserved_unallocated,1236992},
      {strategy,rss},
      {total,[{erlang,60776608},{rss,72409088},{allocated,71172096}]}]},
 {alarms,[]},
 {listeners,[{clustering,25672,"::"},{amqp,5672,"::"}]},
 {vm_memory_calculation_strategy,rss},
 {vm_memory_high_watermark,0.4},
 {vm_memory_limit,3242254336},
 {disk_free_limit,50000000},
 {disk_free,717191835648},
 {file_descriptors,
     [{total_limit,924},{total_used,2},{sockets_limit,829},{sockets_used,0}]},
 {processes,[{limit,1048576},{used,223}]},
 {run_queue,1},
 {uptime,12},
 {kernel,{net_ticktime,60}}]

集群状态(目前只有一个节点)

# rabbitmqctl cluster_status
Cluster status of node rabbit@mhc-linux ...
[{nodes,[{disc,['rabbit@mhc-linux']}]},
 {running_nodes,['rabbit@mhc-linux']},
 {cluster_name,<<"rabbit@mhc-linux">>},
 {partitions,[]},
 {alarms,[{'rabbit@mhc-linux',[]}]}]

启用ui

rabbitmq-plugins enable rabbitmq_management

增加用户

rabbitmqctl add_user root root123

授予权限

rabbitmqctl set_user_tags root management

验证用户

rabbitmqctl authenticate_user root root123

原文地址:https://www.cnblogs.com/mhc-fly/p/11317886.html