Distributed Message Queuing ROCKETMQ deployment

Source: Internet
Author: User

First, ROCKETMQ Introduction:

ROCKETMQ is a distributed, queue-model messaging middleware with the following features:

1, support the strict message order;

2, support topic and queue two modes;

3, million-level message stacking capacity;

4, the more friendly distributed characteristics;

5. Support Push and pull mode consumption message at the same time;

Website Link:

Rocketmq:https://github.com/alibaba/rocketmq/releases

ROCKETMQ GITHUB:HTTPS://GITHUB.COM/ALIBABA/ROCKETMQ

ROCKETMQ cluster Installation:  

ROCKETMQ has multiple clusters, and this is the dual master cluster.

Advantages: The advantages: Simple configuration, the message will not be lost (asynchronous brush disk loss of a small number of messages, synchronous brush disk without losing) the highest performance

First, pre-preparation

The host (two units) is the centOs6.5 system, the IP corresponds to the host name as follows:

10.10. 10.23 rocketmq-master1 #ip和主机名 10.10. 10.24 Rocketmq-master2

Required Software:

Jdk1. 6 . 0_45.tar.gz    #jdk软件alibaba-rocketmq-3.2. 6. tar.gz      #mq软件包

Hosts information added: (two hosts are added to the hosts)

# vim/etc/hosts10.10.10.23     mqnameserver1 #ip对应brokerName10.10.10.24     mqnameserver2 10.10.10.23     rocketmq-master1        #ip对应 host name 10.10.10.24     rocketmq-master2        #ip对应 Host name

Second, installation :

1.> Installing the JDK

1Jdk1.6.0_45.tar.gz#Package2 #TAR-ZXVF jdk1.6.0_45.tar.gz-c/apps/product/3 #ln-s/apps/product/jdk1.6.0_45 Java4 5 #environment variable Configuration6 #Vim/etc/profile7java_home=/apps/product/Java8Classpath=.: $JAVA _home/lib/tools.jar: $JAVA _home/lib/Dt.jar9Path= $JAVA _home/Bin: $PATHTen export Java_home CLASSPATH PATH One  Asource/etc/ Profile -View JDK version: Java-version

2.>ROCKETMQ Installation: (MQ version: 3.2.6)

1>>TAR-ZXVF alibaba-rocketmq-3.2.6.tar.gz-c/apps/product/2>>cd/apps/product/3>>MV alibaba-rocketmq-3.2.6ROCKETMQ4 5 environment variable settings:6>>vim/etc/ Profile7java_home=/apps/product/Java8Classpath=.: $JAVA _home/lib/tools.jar: $JAVA _home/lib/Dt.jar9Path= $JAVA _home/Bin: $PATHTenrocketmq_home=/apps/product/ROCKETMQ One export java_home CLASSPATH PATH rocketmq_home A  ->>source/etc/ Profile -  the>>Useradd Admin ->>cd/apps/product/rocketmq/bin && SH os.sh

3.RocketMQ configuration:

Deploy Broker: Message relay role, responsible for storing messages, forwarding messages

Broker Configuration parameters:

1.> get the default configuration for broker
SH mqbroker-m
How to load the configuration when 2.>broker starts
Generate Broker Default configuration template
SH mqbroker-m >broker.p

3.> Modify the configuration file.
Broker.p

4.> loading a modified configuration file
Nohup sh mqbroker-c broker.p #将broker. p files are copied to the broker-a.properties file, and additional configurations can be added.

(1), Master1 Server (10.10.10.23)

1vim/apps/product/rocketmq/conf/2m-noslave/broker-a.properties2 3namesrvaddr=10.10.10.23:9876;10.10.10.24:98764brokerip1=10.10.10.235brokername=rocketmq-Master16Brokerclustername=Defaultcluster7Brokerid=08autocreatetopicenable=true9autocreatesubscriptiongroup=trueTenRejecttransactionmessage=false OneFetchnamesrvaddrbyaddressserver=false Astorepathrootdir=/root/Store -Storepathcommitlog=/root/store/Commitlog -flushintervalcommitlog=1000 theFlushcommitlogtimed=false -deletewhen=04 -filereservedtime=72 -diskmaxusedspaceratio=88 +maxtransferbytesonmessageinmemory=262144 -Maxtransfercountonmessageinmemory=32 +maxtransferbytesonmessageindisk=65536 AMaxtransfercountonmessageindisk=8 atAccessmessageinmemorymaxratio=40 -messageindexenable=true -Messageindexsafe=false -hamasteraddress= -brokerrole=Async_master -Flushdisktype=Async_flush incleanfileforciblyenable=true -sendmessagethreadpoolnums=128 topullmessagethreadpoolnums=128

(2), Master2 Server (10.10.10.24)

1vim/apps/product/rocketmq/conf/2m-noslave/broker-b.properties2 3namesrvaddr=10.10.10.24:9876;10.10.10.23:98764brokerip1=10.10.10.245brokername=rocketmq-Master26Brokerclustername=Defaultcluster7Brokerid=08autocreatetopicenable=true9autocreatesubscriptiongroup=trueTenRejecttransactionmessage=false OneFetchnamesrvaddrbyaddressserver=false Astorepathrootdir=/root/Store -Storepathcommitlog=/root/store/Commitlog -flushintervalcommitlog=1000 theFlushcommitlogtimed=false -deletewhen=04 -filereservedtime=72 -diskmaxusedspaceratio=88 +maxtransferbytesonmessageinmemory=262144 -Maxtransfercountonmessageinmemory=32 +maxtransferbytesonmessageindisk=65536 AMaxtransfercountonmessageindisk=8 atAccessmessageinmemorymaxratio=40 -messageindexenable=true -Messageindexsafe=false -hamasteraddress= -brokerrole=Async_master -Flushdisktype=Async_flush incleanfileforciblyenable=true -sendmessagethreadpoolnums=128 topullmessagethreadpoolnums=128

(3), runbroker.sh parameter adjustment

vim/apps/product/rocketmq/bin/runbroker.shrunbroker.sh needs to be appropriately adjusted according to memory size java_opt_1="- server-xms8g-xmx8g-xmn2g-xx:permsize=1g-xx:maxpermsize=1g"

Service startup:

Mkdir-p/data/rocketmq/store/commitlog/data/logs #创建日志存放目录 's#${user.home}#/data#g  ' *.xml #更改为data目录

(1), start nameserver "Two starting mode Same"

> cd/apps/product/rocketmq/bin> Nohup sh mqnamesrv &                 or nohup sh mqnamesrv > Nohup.out 2>&am P;1 &

(2), start Brokerserver A "10.10.10.23 host"

cd/apps/product/rocketmq/-C. /conf/2m-noslave/broker-a.properties >/dev/null 2>&1 & or #nohup sh mqbroker-n 10.10.10.23: 9876-c. /conf/2m-noslave/broker-a.properties >/dev/null 2>&1 &

(3), start Brokerserver B "10.10.10.24 host"

> cd/apps/product/rocketmq/-C. /conf/2m-noslave/broker-b.properties  #  nohup sh mqbroker-n 10.10.10.24:9876-c. /conf/2m-noslave/broker-b.properties  

(4), test:

Two machines view log information separately: Tail-100f/data/logs/rocketmqlogs/namesrv.log

Tail-100f/data/logs/rocketmqlogs/broker.log

#netstat-NTLP #查看端口号

# JPS #查看服务

Distributed Message Queuing ROCKETMQ deployment

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.