yum install -y rabbitmq-server
mkdir -p /etc/systemd/system/rabbitmq-server.service.d
vi /etc/systemd/system/rabbitmq-server.service.d/limit.conf
[Service]
LimitNOFILE = 100000
vi /etc/rabbitmq/rabbitmq-env.conf
RABBITMQ_NODE_IP_ADDRESS="本机ip"
RABBITMQ_NODE_PORT=5672
vi /etc/rabbitmq/rabbitmq.config
% Template Path: rabbitmq/templates/rabbitmq.config
[
{kernel,[
{inet_dist_listen_min, 41055},
{inet_dist_listen_max, 41055},
{inet_default_connect_options, [{nodelay,true}]} ]},
{rabbit,[
{cluster_partition_handling, autoheal},
{tcp_listen_options, [
binary,
{packet, raw},
{reuseaddr, true},
{backlog, 4096},
{nodelay, true},
{exit_on_close, false},
{keepalive, true}
]}
{rabbitmq_management,[
{http_log_dir, "/tmp/rabbit-mgmt"},
{rates_mode,none}
]}
scp /var/lib/rabbitmq/.erlang.cookie root@rabbit2:/var/lib/rabbitmq/.erlang.cookie
scp /var/lib/rabbitmq/.erlang.cookie root@rabbit3:/var/lib/rabbitmq/.erlang.cookie
chown rabbitmq:rabbitmq /var/lib/rabbitmq/.erlang.cookie
chown rabbitmq:rabbitmq /etc/rabbitmq/rabbitmq.config
chmod 400 /var/lib/rabbitmq/.erlang.cookie
systemctl daemon-reload
systemctl enable rabbitmq-server.service
systemctl start rabbitmq-server.service
rabbitmqctl cluster_status
rabbitmqctl stop_app
rabbitmqctl join_cluster rabbit@rabbit1
rabbitmqctl start_app
rabbitmqctl cluster_status
rabbitmqctl set_policy ha-all '^(?!amq\.).*' '{"ha-mode": "all"}
rabbitmqctl add_user test
rabbitmqctl set_permissions -p / test test
rabbitmqctl set_user_tags test 角色