rabbitMQ  集群配置


1, install epel yum

    wget http://mirrors.yun-idc.com/epel/6/i386/epel-release-6-8.noarch.rpm

    rpm -vih epel-release-6-8.noarch.rpm


2, install rabbitMQ

    yum -y install rabbitmq-server


3, /etc/hosts configure

  Master rabbitMQ configure

    192.168.8.180 athController.8.180.abs.com.cn athController

    192.168.8.53 athBackup.8.53.abs.com.cn athBackup

  Node rabbitMQ configure

    192.168.8.180 athController.8.180.autohome.com.cn athController

    192.168.8.53 athBackup.8.53.autohome.com.cn athBackup


4, /etc/sysconfig/network  configure

  Master  hostname configure

    sed -i 's/HOSTNAME=.*/HOSTNAME=athController.8.180.abs.com.cn/' /etc/sysconf/network


  Node hostname configure

    sed -i 's/HOSTNAME=.*/HOSTNAME=athBackup.8.53.abs.com.cn/' /etc/sysconf/network


5, disabled selinux

  Master and Node selinux configure

    sed -i 's/SELINUX=.*/SELINUX=disabled/' /etc/selinux/config


6, Congfigure rabbitMQ

  Master rabbitMQ Configure

    1, vim /etc/rabbitmq/rabbit.config

        % This file managed by Puppet

        % Template Path: rabbitmq/templates/rabbitmq.config

        [

          {rabbit, [

            {default_user, <<"guest">>},

            {default_pass, <<"guest">>}

          ]},

          {kernel, [


          ]}

        ].

        % EOF

    2, vim /etc/rabbitmq/rabbit-env.conf

        RABBITMQ_NODE_PORT=5672


  Node rabbitMQ Configure

    1, vim /etc/rabbitmq/rabbit.config

        % This file managed by Puppet

        % Template Path: rabbitmq/templates/rabbitmq.config

        [

          {rabbit, [

            {default_user, <<"guest">>},

            {default_pass, <<"guest">>}

          ]},

          {kernel, [


          ]}

        ].

        % EOF

    2, vim /etc/rabbitmq/rabbit-env.conf

        RABBITMQ_NODE_PORT=5672


7,restart rabbitMQ

  Master restart rabbitMQ

    service rabbitmq-server restart

  Node restart rabbitMQ

    service rabbitmq-server restart


8,configure rabbitmq cluster

  Master rabbitMQ cluster

    rabbitmqctl stop_app

    rabbitmqctl reset

    /usr/lib/rabbitmq/bin/rabbitmq-plugins enable rabbitmq_management

    /usr/lib/rabbitmq/bin/rabbitmq-plugins  enable rabbitmq_management_agent 

   rabbitmqctl start_app


  Node rabbitMQ cluster

    rabbitmqctl join_cluster rabbit@athController.8.180.autohome.com.cn

    rabbitmqctl  stop_app

    rabbitmqctl reset

    /usr/lib/rabbitmq/bin/rabbitmq-plugins enable rabbitmq_management

    /usr/lib/rabbitmq/bin/rabbitmq-plugins  enable rabbitmq_management_agent

    rabbitmqctl join_cluster --ram rabbit@athController

    rabbitmqclt start_app

9,show cluster status

    [root@athBackup yum.repos.d]# rabbitmqctl cluster_status

    Cluster status of node rabbit@athBackup ...

    [{nodes,[{disc,[rabbit@athController]},{ram,[rabbit@athBackup]}]},

     {running_nodes,[rabbit@athController,rabbit@athBackup]},

     {partitions,[]}]

    ...done.