RabbitMQ的安装部署
[root@rabbitmq ~]# cat /etc/redhat-release
CentOS release 6.8 (Final)
[root@rabbitmq ~]# uname -r
2.6.32-642.el6.x86_64
#基础环境配置hostname sed -i "2c HOSTNAME=rabbitmq" /etc/sysconfig/network hostname rabbitmq #设置连接数最大值 echo '* - nofile 65535' >>/etc/security/limits.conf ulimit -SHn 65535 #selinux sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config setenforce 0 getenforce #chkconfig export LANG=en for zsq in `chkconfig --list|grep "3:on"|awk '{print $1}'|grep -vE "crond|network|rsyslog|sshd"` do chkconfig $zsq off done /etc/init.d/iptables stop #date yum -y install ntpdate \cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime echo "#time sync by zsq at $(date +%F)" >> /var/spool/cron/root echo "*/10 * * * * /usr/sbin/ntpdate 10.10.88.1 &>/dev/null" >>/var/spool/cron/root #Install rabbitmq yum install wget vim -y cd /usr/local/src/ wget http://www.rabbitmq.com/releases/erlang/erlang-18.3.4.4-1.el6.x86_64.rpm rpm -ivh erlang-18.3.4.4-1.el6.x86_64.rpm wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm rpm -ivh epel-release-6-8.noarch.rpm #安装出错可以替换下YUM链接 # sed -i -e '3 s/^#//' /etc/yum.repos.d/epel.repo # sed -i -e '4 s/^/#/' /etc/yum.repos.d/epel.repo yum install socat -y wget http://www.rabbitmq.com/releases/rabbitmq-server/v3.6.6/rabbitmq-server-3.6.6-1.el6.noarch.rpm rpm -ivh rabbitmq-server-3.6.6-1.el6.noarch.rpm cd /etc/rabbitmq cp /usr/share/doc/rabbitmq-server-3.6.6/rabbitmq.config.example /etc/rabbitmq/ mv rabbitmq.config.example rabbitmq.config touch rabbitmq-env.conf cat >> rabbitmq-env.conf << eof RABBITMQ_LOG_BASE=/home/rabbitmq/log eof mkdir /home/rabbitmq/log -p chown rabbitmq.rabbitmq -R /home/rabbitmq /etc/init.d/rabbitmq-server start chkconfig rabbitmq-server on #Add user rabbitmqctl add_user admin admin #创建用户 rabbitmqctl set_user_tags admin administrator rabbitmq-plugins enable rabbitmq_management #开启管理界面 #rabbitmq.config文件 sed -i '64 d' rabbitmq.config sed '63 a {loopback_users, []},' -i rabbitmq.config sed '218 a{vm_memory_high_watermark, 0.9}' -i rabbitmq.config #内存设置 #rabbitmq数据是根据当前hostname作为node节点作为数据名保存、重启会丢失用户信息
添加rabbitmq固定节点名字,保证数据文件不变,添加新用户
echo 'NODENAME=rabbit@q' | sudo tee -a /etc/rabbitmq/rabbitmq-env.conf echo '127.0.0.1 q' | sudo tee -a /etc/hosts 查看rabbitmq的数据保存路径 cd /var/lib/rabbitmq/mnesia/ | ls
service rabbitmq-server restart 其它命令: rabbitmqctl list_users #查看用户信息 rabbitmqctl list_queues #显示队列 rabbitmqctl change_password API API123.. #修改用户API密码 rabbitmq配置 一般情况下,RabbitMQ的默认配置就足够了。如果希望特殊设置的话,有两个途径: 一个是环境变量的配置文件 /etc/rabbitmq/rabbitmq-env.conf ; 一个是配置信息的配置文件 /etc/rabbitmq/rabbitmq.conf; 注意,这两个文件默认是没有的,如果需要必须自己创建。 管理web界面登陆 在浏览器中输入http://127.0.0.1:15672/ 输入用户名和密码(默认为guest)