rabbitmq下载:https://github.com/rabbitmq/rabbitmq-server/releases/download/v3.8.34/rabbitmq-server-generic-unix-3.8.34.tar.xz
erlang下载:https://github.com/erlang/otp/releases/download/OTP-24.3.4.1/otp_src_24.3.4.1.tar.gz
[root@zhcs-cvm-01]# hostnamectl set-hostname zhcs-cvm-01
[root@zhcs-cvm-01]# hostname zhcs-cvm-01
[root@zhcs-cvm-02]# hostnamectl set-hostname zhcs-cvm-02
[root@zhcs-cvm-02]# hostname zhcs-cvm-02
[root@zhcs-cvm-03]# hostnamectl set-hostname zhcs-cvm-03
[root@zhcs-cvm-03]# hostname zhcs-cvm-03
[root@zhcs-cvm-01 sbin]# cat /etc/hosts
10.206.0.44 zhcs-cvm-01
10.206.0.45 zhcs-cvm-02
10.206.1.46 zhcs-cvm-03
[root@zhcs-cvm-02 sbin]# cat /etc/hosts
10.206.0.44 zhcs-cvm-01
10.206.0.45 zhcs-cvm-02
10.206.1.46 zhcs-cvm-03
[root@zhcs-cvm-03 sbin]# cat /etc/hosts
10.206.0.44 zhcs-cvm-01
10.206.0.45 zhcs-cvm-02
10.206.1.46 zhcs-cvm-03
[root@zhcs-cvm-01]# ssh-keygen -t rsa
[root@zhcs-cvm-01]# cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys
[root@zhcs-cvm-01]# ssh-copy-id -i /root/.ssh/id_rsa.pub root@zhcs-cvm-02
[root@zhcs-cvm-01]# ssh-copy-id -i /root/.ssh/id_rsa.pub root@zhcs-cvm-03
[root@zhcs-cvm-01]# tar -xf otp_src_24.3.4.1.tar.gz
[root@zhcs-cvm-01]# cd otp_src_24.3.4.1/
[root@zhcs-cvm-01]# ./configure --prefix=/opt/erlang
[root@zhcs-cvm-01]# make && make install
[root@zhcs-cvm-01]# vim /etc/profile
ERL_HOME=/opt/erlang
PATH=$ERL_HOME/bin:$PATH
export ERL_HOME PATH
[root@zhcs-cvm-01]# source /etc/profile
[root@zhcs-cvm-01]# scp /root/.erlang.cookie root@zhcs-cvm-02:/root/.erlang.cookie
[root@zhcs-cvm-01]# scp /root/.erlang.cookie root@zhcs-cvm-03:/root/.erlang.cookie
三台均操作:
[root@zhcs-cvm-01]# tar -xf rabbitmq-server-generic-unix-3.8.34.tar.xz
[root@zhcs-cvm-01]# cd rabbitmq_server-3.8.34
[root@zhcs-cvm-01]# ./sbin/rabbitmq-plugins enable rabbitmq_management
[root@zhcs-cvm-01]# ./sbin/rabbitmq-server -detached
只在其他节点操作:
[root@zhcs-cvm-01 sbin]# ./rabbitmqctl stop_app
[root@zhcs-cvm-01 sbin]# ./rabbitmqctl reset
[root@zhcs-cvm-01 sbin]# ./rabbitmqctl join_cluster rabbit@zhcs-cvm-01
[root@zhcs-cvm-01 sbin]# ./rabbitmqctl start_app
[root@zhcs-cvm-01 sbin]# ./rabbitmqctl add_user admin password
[root@zhcs-cvm-01 sbin]# ./rabbitmqctl set_permissions -p / admin ".*" ".*" ".*"
[root@zhcs-cvm-01 sbin]# ./rabbitmqctl set_user_tags admin administrator
rabbitmqctl set_permissions --vhost
虚拟主机 用户名 “对哪些实体有配置权限” “对哪些实体有写权限” “对哪些实体有读权限”
rabbitmqctl set_permissions --vhost "/" fkjava ".*" ".*" ".*"
[root@zhcs-cvm-01 sbin]#./rabbitmqctl cluster_status
Cluster status of node rabbit@zhcs-cvm-01 ...
Basics
Cluster name: rabbit@zhcs-cvm-01
Disk Nodes
rabbit@zhcs-cvm-01
rabbit@zhcs-cvm-02
rabbit@zhcs-cvm-03
Running Nodes
rabbit@zhcs-cvm-01
rabbit@zhcs-cvm-02
rabbit@zhcs-cvm-03
Versions
rabbit@zhcs-cvm-01: RabbitMQ 3.8.34 on Erlang 24.3.4.1
rabbit@zhcs-cvm-02: RabbitMQ 3.8.34 on Erlang 24.3.4.1
rabbit@zhcs-cvm-03: RabbitMQ 3.8.34 on Erlang 24.3.4.1
Maintenance status
Node: rabbit@zhcs-cvm-01, status: not under maintenance
Node: rabbit@zhcs-cvm-02, status: not under maintenance
Node: rabbit@zhcs-cvm-03, status: not under maintenance
Alarms
(none)
Network Partitions
(none)
Listeners
Node: rabbit@zhcs-cvm-01, interface: [::], port: 15672, protocol: http, purpose: HTTP API
Node: rabbit@zhcs-cvm-01, interface: [::], port: 25672, protocol: clustering, purpose: inter-node and CLI tool communication
Node: rabbit@zhcs-cvm-01, interface: [::], port: 5672, protocol: amqp, purpose: AMQP 0-9-1 and AMQP 1.0
Node: rabbit@zhcs-cvm-02, interface: [::], port: 15672, protocol: http, purpose: HTTP API
Node: rabbit@zhcs-cvm-02, interface: [::], port: 25672, protocol: clustering, purpose: inter-node and CLI tool communication
Node: rabbit@zhcs-cvm-02, interface: [::], port: 5672, protocol: amqp, purpose: AMQP 0-9-1 and AMQP 1.0
Node: rabbit@zhcs-cvm-03, interface: [::], port: 15672, protocol: http, purpose: HTTP API
Node: rabbit@zhcs-cvm-03, interface: [::], port: 25672, protocol: clustering, purpose: inter-node and CLI tool communication
Node: rabbit@zhcs-cvm-03, interface: [::], port: 5672, protocol: amqp, purpose: AMQP 0-9-1 and AMQP 1.0
Feature flags
Flag: drop_unroutable_metric, state: enabled
Flag: empty_basic_get_metric, state: enabled
Flag: implicit_default_bindings, state: enabled
Flag: maintenance_mode_status, state: enabled
Flag: quorum_queue, state: enabled
Flag: user_limits, state: enabled
Flag: virtual_host_metadata, state: enabled