搭建步骤
一、环境准备
- 服务器 Centos6.8 64位
- JDK 1.8 64位
- maven 3.5.0
- git
- rocketmq-4.0.0
- rocketmq-externals
二、配置环境变量
JAVA_HOME=/opt/jdk/
M2_HOME=/opt/maven/
PATH=$PATH:$JAVA_HOME/bin:$M2_HOME/bin
export JAVA_HOME M2_HOME PATH
source /etc/profile
三、安装、启动RocketMQ
1.下载安装
cd /opt
wget https://codeload.github.com/apache/rocketmq/tar.gz/rocketmq-4.0.0-incubating
tar -zxvf rocketmq-rocketmq-4.0.0-incubating.tar.gz
cd rocketmq-rocketmq-4.0.0-incubating
#生成安装包
mvn -Prelease-all -DskipTests clean package install assembly:assembly -U
#拷贝包文件
cp target/apache-rocketmq-all.tar.gz /usr/local/rocketmq
cd /usr/local/rocketmq
#创建目录
mkdir /data/rocketmq/store/{consumequeue,commitlog} -p
#修改日志目录
sed -i 's#${user.home}#/data/rocketmq#g' *.xml
2.修改JVM参数
-server -Xms8g -Xmx8g -Xmn4g
-XX:+UseG1GC -XX:G1HeapRegionSize=16m -XX:G1ReservePercent=25 -XX:InitiatingHeapOccupancyPercent=30 -XX:SoftRefLRUPolicyMSPerMB=0 -XX:SurvivorRatio=8 -XX:+DisableExplicitGC -verbose:gc -Xloggc:/dev/shm/mq_gc_%p.log -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCApplicationStoppedTime -XX:+PrintAdaptiveSizePolicy -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=30m
3.启动nameserver
nohup sh mqnamesrv &
*--提示“The Name Server boot success. serializeType=JSON”
启动成功
4.配置broker
vim conf/broker.conf
brokerClusterName=DefaultCluster
namesrvAddr=x.x.x.x:9876;x.x.x.x:9876;
brokerName=broker-a
brokerId=0
deleteWhen=04
fileReservedTime=72
brokerRole=ASYNC_MASTER
flushDiskType=ASYNC_FLUSH
storePathCommitLog=/data/rocketmq/store/commitlog/
storePathConsumerQueue=/data/rocketmq/store/consumequeue/
mapedFileSizeCommitLog=1g
5.启动broker
sh bin/mqbroker -c ./conf/broker.conf &
6.查看状态
> rocketmq]# jps
31076 Jps
18359 NamesrvStartup
12654 QuorumPeerMain
19086 BrokerStartup
>sh bin/mqadmin clusterList -n x.x.x.x:9876
有记录及可
四、安装rocketmq-console
1.下载tomcat
cd /opt
wget http://mirror.bit.edu.cn/apache/tomcat/tomcat-8/v8.5.23/bin/apache-tomcat-8.5.23.tar.gz
tar -zxf apache-tomcat-8.5.23.tar.gz
2.下载rocketmq-console.war
git clone https://github.com/apache/rocketmq-externals.git
cd /opt/rocketmq-externals/rocketmq-console
修改src/main/resources/application.properties
rocketmq.config.namesrvAddr=x.x.x.x:9876;x.x.x.x:9876;
#打包
cd /opt/rocketmq-externals/rocketmq-console
mvn clean package -Dmaven.test.skip=true
3.启动并访问
java -jar target/rocketmq-console-ng-1.0.0.jar
http://x.x.x.x:8080
网友评论