下載 0依賴Erlang RPM for RabbitMQ包(https://github.com/rabbitmq/erlang-rpm)html
https://dl.bintray.com/rabbitmq/rpm/erlang/20/el/7git
或者使用yum庫(centos7):github
cat /etc/yum.repos.d/rabbitmq-erlang.repo [rabbitmq-erlang] name=rabbitmq-erlang baseurl=https://dl.bintray.com/rabbitmq/rpm/erlang/20/el/7 gpgcheck=1 gpgkey=https://www.rabbitmq.com/rabbitmq-release-signing-key.asc repo_gpgcheck=0 enabled=1
centos6 yum庫centos
cat /etc/yum.repos.d/rabbitmq-erlang.repo [rabbitmq-erlang] name=rabbitmq-erlang baseurl=https://dl.bintray.com/rabbitmq/rpm/erlang/20/el/6 gpgcheck=1 gpgkey=https://dl.bintray.com/rabbitmq/Keys/rabbitmq-release-signing-key.asc repo_gpgcheck=0 enabled=1
yum -y install erlangtcp
下載rabbitmq RPM包url
http://www.rabbitmq.com/download.htmlcentos7
選擇spa
RHEL/CentOS 7.xcode
yum -y install rabbitmq-server-3.7.2-1.el7.noarch.rpmserver
配置
mkdir /etc/rabbitmq
touch /etc/rabbitmq/enabled_plugins
cat /etc/rabbitmq/rabbitmq.config [ {rabbit, [{vm_memory_high_watermark, 0.6}]}, { rabbit, [{tcp_listeners,[5672]}, {heartbeat, 60}, {cluster_partition_handling, autoheal}] }, { rabbitmq_management, [{listener, [{port, 15672}]}] }, { kernel, [{inet_dist_listen_min, 40000},{inet_dist_listen_max, 45000}] }, {rabbit, [{log_levels, [{connection, info}, {channel, info}]}]} ].
cat /etc/rabbitmq/rabbitmq-env.conf NODENAME=rabbit@cs172-16-0-29
啓動腳本:
cat /usr/lib/systemd/system/rabbitmq.service [Unit] Description=RabbitMQ broker After=syslog.target network.target [Service] Type=notify LimitNOFILE=65535 User=rabbitmq Group=rabbitmq WorkingDirectory=/var/lib/rabbitmq ExecStart=/usr/sbin/rabbitmq-server ExecStop=/usr/sbin/rabbitmqctl stop ExecStop=/bin/sh -c "while ps -p $MAINPID >/dev/null 2>&1; do sleep 1; done" NotifyAccess=all TimeoutStartSec=3600 [Install] WantedBy=multi-user.target
若是total_limit參數 經過向 /etc/sysctl.conf 添加fs.file-max=65535
向 /etc/security/limits.conf 添加
* soft nofile 65535
* hard nofile 65535
* soft nproc 65535
* hard nproc 65535