RocketMQ 安装与部署
2018, Jun 19
本文档介绍RocketMQ
安装,部署,及简要使用(以ubuntu 16.04
为例)
简介
RocketMQ 是由阿里用java
语言开发的一款高性能、高吞吐量的分布式消息中间件,于2017年正式捐赠 Apache 基金会并成为顶级开源项目。
安装与部署
-
install
jvm
sudo apt-get update sudo apt-get install default-jdk
-
install
maven
sudo apt-get install maven
-
download & build from release
wget http://mirrors.tuna.tsinghua.edu.cn/apache/rocketmq/4.2.0/rocketmq-all-4.2.0-source-release.zip
unzip rocketmq-all-4.2.0-source-release.zip cd rocketmq-all-4.2.0/ mvn -Prelease-all -DskipTests clean install -U cd distribution/target/apache-rocketmq
-
update configs
vim bin/runserver.sh vim bin/runbroker.sh vim bin/tools.sh
修改
JAVA_HOME
及Xms
,Xmx
,Xmn
等内存配置,默认最小4GJAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64/jre #[ ! -e "$JAVA_HOME/bin/java" ] && JAVA_HOME=$HOME/jdk/java #[ ! -e "$JAVA_HOME/bin/java" ] && JAVA_HOME=/usr/java #[ ! -e "$JAVA_HOME/bin/java" ] && error_exit "Please set the JAVA_HOME variable in your environment, We need java(x64)!" JAVA_OPT="${JAVA_OPT} -server -Xms256m -Xmx256m -Xmn128m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=320m"
-
start name server
nohup sh bin/mqnamesrv & tail -f ~/logs/rocketmqlogs/namesrv.log
-
start broker
nohup sh bin/mqbroker -n localhost:9876 & tail -f ~/logs/rocketmqlogs/broker.log
-
send & receive messages
export NAMESRV_ADDR=localhost:9876 sh bin/tools.sh org.apache.rocketmq.example.quickstart.Producer sh bin/tools.sh org.apache.rocketmq.example.quickstart.Consumer