Last November Ali's ROCKETMQ entered the open source incubation stage of Apache, this is borrowed from the kafa,11 of the Java version, after Taobao these years of continuous improvement, function has been very strong; As a technician must learn to master, Today, with colleagues to download the installation run a bit, found to really want to run up in the middle of a lot of pits, not so smooth, in order to save the rest of the time, summed up here; follow this step and you'll run.
Download compilation git address https://github.com/apache/incubator-rocketmq;
Download release-4.0.0-incubating version
Download to the source package after decompression, into the source directory, the implementation of MAVEN command compiled packaging (Maven did not configure their own to Baidu): Mvn-dmaven.test.skip=true Clean Package Install assembly:assembly
- P Release-all-U Note the-P Release-all parameter must be added
After compiling in the target directory, the Apache-rocketmq-all directory contains all the content, apache-rocketmq-all.tar.gz is its compressed package; Then the apache-rocketmq-all.tar.gz, copy to the Linux system decompression operation;
Start
The unpacked directory structure is as follows: [root@jenkins apache-rocketmq-all]# ll total dosage drwxr-xr-x 2 root 4096 March 9 15:16 benchmark Drwxr-xr-x 2 Root 4096 March 9 16:41 bin Drwxr-xr-x 5 root root 4096 March 9 16:42 conf-rw-r--r--1 root root 525 March 9 15:16 Disclaimer Drwxr-xr-x 2 root 4096 March 9 15:16 lib-rw-r--r--1 root root 16129 March 9 15:16 license-rw-r--r--1 R Oot Root 1385 March 9 15:16 notice-rw-r--r--1 root root 2362 March 9 15:16 readme.md
Enter the bin directory launch script [root@jenkins apache-rocketmq-all]# CD bin [root@jenkins bin]# ll total dosage 100-rwxr--r--1 root root 1654 March &nb Sp 9 15:38 cachedog.sh-rwxr--r--1 root root 845 March 9 15:38 cleancache.sh-rwxr--r--1 root root 1116 March 9 15:38 cleancache.v1.sh-rw-r--r--1 root root 1398 March 9 15:38 mqadmin-rw-r--r--1 root root 1344 March 9 15 : mqadmin.xml-rw-r--r--1 root 1394 March 9 15:38 mqbroker-rw-r--r--1 root root 1373 March 9 15:38 Mqbro ker.numanode0-rw-r--r--1 root 1373 March 9 15:38 mqbroker.numanode1-rw-r--r--1 root root 1373 March 9 15: mqbroker.numanode2-rw-r--r--1 root 1373 March 9 15:38 mqbroker.numanode3-rw-r--r--1 root root 1336 March &nbs P 9 15:38 mqbroker.xml-rw-r--r--1 root root 1400 March 9 15:38 mqfiltersrv-rw-r--r--1 root root 1342 March 9 15: mqfiltersrv.xml-rwxr--r--1 root 1396 March 9 15:38 mqnamesrv-rw-r--r--1 root root 1338 March 9 15:38 m qnamesrv.xml-rw-r--r--1 root 1571 March 9 15:38 mqshutdown-rw-------1 root root 866 March 9 15:39 nohup.out-rwxr--r --1 root 2214 March 9 15:38 os.sh-rwxr--r--1 root root 1008 March 9 15:38 play.sh-rw-r--r--1 root root & nbsp;772 March 9 15:38 readme.md-rwxr--r--1 root root 2828 March 9 15:38 runbroker.sh-rwxr--r--1 root root 239 1 March 9 15:38 runserver.sh-rwxr--r--1 root root 1156 March 9 15:38 setcache.sh-rwxr--r--1 root root 1408 March 9 15:38 startfsrv.sh-rwxr--r--1 root root 1870 March 9 15:38 tools.sh
We are going to execute two startup scripts, one is to start nameserver to provide routing functionality, and one is to initiate broker responsible for message processing;
Before executing the startup script, replace the Chinese carriage return line of the window in the script with the return line character under Linux, or the run script will go into the bin directory and execute the following command: [root@jenkins bin]# sed-i ' s/\r//g ' *
Start nameserver nameserver do not need to configure a direct boot, execute the following command [root@jenkins bin]# nohup sh mqnamesrv & This script eventually invokes the runserver.sh script, which has the JVM boot parameters configured as follows java_opt= "${java_opt}-server-xms4g-xmx4g-xmn2g-xx:permsize=128m-xx: maxpermsize=320m "Default Listener port is 9876
Start broker broker needs to be configured to start
The configuration file is stored in the Conf directory
Drwxr-xr-x 2 root 4096 March 9 18:05 2m-2s-async drwxr-xr-x 2 root root 4096 March 9 18:07 2m-2s-sync drwxr-xr-x 2 ro OT root 4096 March 9 17:26 2m-noslave-rw-r--r--1 root root 1023 March 9 17:24 broker.conf-rw-r--r--1 root root 14235 3 Month 9 15:16 logback_broker.xml-rw-r--r--1 root root 3825 March 9 15:16 logback_filtersrv.xml-rw-r--r--1 root root 380 3 March 9 15:16 logback_namesrv.xml-rw-r--r--1 root root 3889 March 9 15:16 logback_tools.xml 2m-2s-async The configuration file under this directory is master-slave Step of the configuration file sample 2m-2s-sync This directory is a master-slave configuration file Sample 2m-noslave the configuration file in this directory is not from the profile sample
Randomly open a broker.conf configuration file, which reads as follows:
#nameserver, the brokerclustername of the broker is the same as stating that they are under a cluster; Brokerclustername=defaultcluster #broker的名称, if it is a master-slave configuration, The parameter name must be set to the same, and then brokerid to distinguish the master from the Brokername=broker-a #来判断是主还是从, the master must be 0, from the value greater than 1; Brokerid=0 deletewhen=04 FILERESERVEDTIME=48 # Broker's role: 1. Async_master asynchronous replication of master;2. Sync_master Synchronous Double Write Master,slave brokerrole=async_master #刷盘: 1. Async_flush asynchronous brush disk, high performance; 2. Sync_flush Synchronous Brush disk, low performance Flushdisktype=async_flush #配置nameserver的ip, multiple separated by semicolons; namesrvaddr=192.168.2.246:9876; 192.168.2.247:9876;
NAMESRVADDR must be configured to start broker after the configuration is good; [Root@jenkins rocketmqlogs]# nohup sh mqbroker-c/var/opt/apache-rocketmq-all/conf/2m-2s-async/ Broker-a-s.properties &-C command to specify the path to the configuration file
Run Log After running, the output log is stored under the ~/logs/rocketmqlogs/path [root@jenkins rocketmqlogs]# cd ~/logs/rocketmqlogs/[Root@jenkins Rocketmqlogs] # ll-t Total dosage 1624-rw-r--r--1 root 17744 March 9 20:42 namesrv.log-rw-r--r--1 root root 1222480 March   ; 9 18:52 watermark.log-rw-r--r--1 root root 121997 March 9 18:51 broker.log-rw-r--r--1 root root 246306 March 9 18:51 store.log-rw-r--r--1 root root 21977 March 9 18:49 remoting.log-rw-r--r--1 root root &nb Sp 0 March 9 15:54 commercial.log-rw-r--r--1 root 0 March 9 15:54 Stats.log -rw-r--r--1 root 0 March 9 15:54 lock.log-rw-r--r--1 root root 0 March 9 15:54 transaction.log-rw-r--r--1 root root 0 March 9 15:54 storeerror.log-rw-r--r-- 1 root 0 March 9 15:54 protection.log-rw-r--r--1 root 0 March   ; 9 15:54 Broker_default.log-rw-r--r--1 root 0 March 9 15:39 Namesrv_default.log
If you want to modify the log storage path, to the Conf directory to modify the configuration of Logback;
That's when broker started up;
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.