linux安装 rocketmq
1、安装 rocketmq首先要有java以及maven环境,这里略过,可参考
https://www.cnblogs.com/xiaobaoTribe/p/11315011.html 安装JDK 1.8
https://www.cnblogs.com/xiaobaoTribe/p/11361881.html 安装maven 3.5.1
2、切换目录
:~$ cd /usr/local
3、按照官网指示,下载源文件 rocketmq-all-4.4.0-source-release.zip,下载页http://rocketmq.apache.org/dowloading/releases/
:/usr/local$ wget http://mirrors.tuna.tsinghua.edu.cn/apache/rocketmq/4.4.0/rocketmq-all-4.4.0-source-release.zip
4、解压文件
:/usr/local$ unzip rocketmq-all-4.4.0-source-release.zip
5、删除文件
:/usr/local$ remove rocketmq-all-4.4.0-source-release.zip
6、编译打包程序
切换目录
:/usr/local$ cd rocketmq-all-4.4.0/
编译打包
:/usr/local/rocketmq-all-4.4.0$ mvn -Prelease-all -DskipTests clean install -U
7、运行
切换目录
:/usr/local/rocketmq-all-4.4.0$ cd distribution/target/apache-rocketmq
启动nameserver
root @ubuntu:/usr/local/rocketmq-all-4.4.0/distribution/target/apache-rocketmq$ nohup sh bin/mqnamesrv &
[1] 3107
:/usr/local/rocketmq-all-4.4.0/distribution/target/apache-rocketmq$ nohup: 忽略输入并把输出追加到‘/home/root/nohup.out‘
启动broker
:/usr/local/rocketmq-all-4.4.0/distribution/target/apache-rocketmq$ nohup sh bin/mqbroker -n localhost:9876 &
[2] 3134
:/usr/local/rocketmq-all-4.4.0/distribution/target/apache-rocketmq$ nohup: 忽略输入并把输出追加到‘/home/root/nohup.out‘
备注:这里注意启动可能要注意调下内存设定,最低4G,调内存可在将bin目录下面的runserver.sh、runbroker.sh文件关于启动内存设定参数调整一下 ,修改成
JAVA_OPT=”${JAVA_OPT} -server -Xms256m -Xmx256m -Xmn128m”
8、按照官网给的简单以及其他示例
进行客户端测试,这里略过
9、安装控制台
前提安装git
切换目录
:~$ cd /usr/local
创建目录
:/usr/local$ mkdir rocketmq
下载工程
:/usr/local/rocketmq$ git clone https://github.com/apache/rocketmq-externals.git
切换目录
:/usr/local/rocketmq$ cd rocketmq-externals/rocketmq-console/
:/usr/local/rocketmq/rocketmq-externals/rocketmq-console/$ vi src/main/resources/application.properties
#管理后台访问上下文路径,默认为空,如果填写,一定要前面加“/”,后面不要加,否则启动报错
server.contextPath=/rocketmq
#访问端口
server.port=80
spring.application.index=true
spring.application.name=rocketmq-console
spring.http.encoding.charset=UTF-8
spring.http.encoding.enabled=true
spring.http.encoding.force=true
打包编译
:/usr/local/rocketmq/rocketmq-externals/rocketmq-console/$ mvn clean package -Dmaven.test.skip=true
:/usr/local/rocketmq/rocketmq-externals/rocketmq-console/$ java -jar target/rocketmq-console-ng-1.0.1.jar
#如果配置文件没有填写Name Server
:/usr/local/rocketmq/rocketmq-externals/rocketmq-console/$ $ java -jar target/rocketmq-console-ng-1.0.1.jar --rocketmq.config.namesrvAddr=‘192.168.8.114:9876‘
输入
最后完成了