1. Experimental environment
rabbitmq-node1.com192.168.1.112rabbitmq-node2.com192.168.1.113rabbitmq-node3.com192.168.1.128
2. Check synchronization time before configuration
#ntpdate pool.ntp.org
3, attention must be changed the hosts
#cat/etc/hosts192.168.1.112 rabbitmq-node1.com rabbitmq-node1192.168.1.113 rabbitmq-node2.com rabbitmq-node2192.168.1.128 rabbitmq-node3.com Rabbitmq-node3
4. Installing Erlang
#yum-y Install Erlang
5, installation rabbitqmq
#wget http://www.rabbitmq.com/releases/rabbitmq-server/v2.8.6/rabbitmq-server-2.8.6-1.noarch.rpm#yum-y Install rabbitmq-server-2.8.6-1.noarch.rpm [[email protected] ~]#/etc/init.d/rabbitmq-server startstarting rabbitmq-server: Successrabbitmq-server.
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/56/C7/wKiom1SNk0rzDHwLAAMCEmLBc80539.jpg "title=" r2.jpg "alt=" Wkiom1snk0rzdhwlaamcemlbc80539.jpg "/>
# RABBITMQCTL Status//view state
6. installing the plug-in management interface
#mkdir-M 777/etc/rabbitmq/(if the directory already exists direct execution # chmod 777/etc/rabbitmq/) #rabbitmq-plugins enable Rabbitmq_ Management Restart Rabbitmq-server#rabbitmqctl stop#/etc/init.d/rabbitmq-server start
Check that the management port has no boot:
# Netstat-tnlp|grep 55672
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/56/C5/wKioL1SNk6HAqqi-AAKaRTzIU9g550.jpg "title=" r3.jpg "alt=" wkiol1snk6haqqi-aakartziu9g550.jpg "/>
Browser Open http://IP:55672 account password is guest
note :rabbitmq Span style= "font-family: ' The song Body '; > from 3.3.0 start to prohibit use guest/guest permissions by removing localhost
If you want to use guest/guest with remote machine access, you need to be in the rabbitmq configuration file (/etc/rabbitmq/ Rabbitmq.config) , set loopback_users to [].
the full contents of the/etc/rabbitmq/rabbitmq.config file are as follows (note the following half-width period):
[{rabbit, [{loopback_users, []}]}].
7 ,rabbitmq cluster configuration
(1) set each node Cookie
Rabbitmqthe cluster is dependent on theErlangcluster to work, you must first build theErlangcluster environment. Erlangthe nodes in the cluster are through aMagic Cookiecome true, thisCookiesstored in/var/lib/rabbitmq/.erlang.cookie, the file is -the permissions. So it is necessary to ensure that each nodeCookiesconsistent, otherwise communication between nodes is not possible
# Cat/var/lib/rabbitmq/.erlang.cookie EJARCZORCOTEQWFGPWXR
(2) Stop all nodes rabbitm Q service, and then use the detached parameter to run independently, this step is critical, especially to increase the node stop node after restarting the encounter cannot start can be referenced in this order
[[Email protected] ~] #rabbitmq-server-detached[[email protected] ~] #rabbitmq-server-detached[[email protected] ~]# Rabbitmq-server-detached
(3) about node types (Ram |disk)
The state of the Ram node is saved in memory, and the disk node is saved to the disks that are added to the diskette , as in this example [email Protected] 2to beRamnode,[email protected] 1,[email protected] is a Ram node ,you can change the joined cluster and the node type by rabbitmqctl the cluster command after the command can be added to multiple node names, the specified node becomes a disk node
[[Email protected] ~] #rabbitmqctl cluster_status[[email protected] ~] #rabbitmq stop_app[[email protected] ~]# Rabbitmqctl Reset[[email protected] ~] #rabbitmqctl cluster[[email protected] ~] #rabbitmqctl Start_app specified as Ram[[email Protected] ~] #rabbitmq stop_app[[email protected] ~] #rabbitmqctl reset[[email protected] ~] #rabbitmqctl cluster [email Protected][[email protected] ~] #rabbitmqctl Start_app designated as Disc[[email protected] ~] #rabbitmq stop_app[[email protected] ~] #rabbitmqctl Reset[[email protected] ~] #rabbitmqctl cluster [email protected] [email protected][[email protected] ~]# Rabbitmqctl Start_app
(4) automatic configuration of the cluster, default file is not, if necessary must be manually created
[Email protected] ~]# cat/etc/rabbitmq/rabbitmq.conf [... {Rabbit, [... {cluster_nodes, [' [email protected] ', ' [email protected] ', ' [email protected] '}, ...]. [Email protected] ~]# cat/etc/rabbitmq/rabbitmq-env.conf rabbitmq_mnesia_base=/var/lib/rabbitmq/// Path of the Mnesia database that needs to be used Rabbitmq_log_base=/var/log/rabbitmq///log rabbitmq_plugins_dir=/usr/lib/rabbitmq/lib/ rabbitmq_server-2.8.6/plugins//Plug-in Path
(5) automatically join the cluster when you start
[[Email protected] ~] #rabbitmq-server-detached[[email protected] ~]# rabbitmqctl cluster_statuscluster Status of node ' [ Email protected] ' ... [{nodes,[{disc,[' [email protected] ', ' [email protected] '}, {ram,[' [email protected] '}]}, {running_nodes,[' [email Protected] ', ' [email protected] ', ' [email protected] ']}]...done.
(6) All node information can be seen in the browser, if other node information is not displayed enable Web management is good
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/56/C5/wKioL1SNlEjS6BUiAAMw5AoTxCo107.jpg "title=" r5.jpg "alt=" wkiol1snlejs6buiaamw5aotxco107.jpg "/>
This article is from the "Bamboo Potential" blog, please be sure to keep this source http://peaceweb.blog.51cto.com/3226037/1589875
CENTOS+RABBITMQ cluster configuration