安装rocketmq并配置管理界面
1、下载rocketmq
cd /opt
wget http://mirror.bit.edu.cn/apache/rocketmq/4.3.2/rocketmq-all-4.3.2-bin-release.zip
unzip rocketmq-all-4.3.2-bin-release.zip
cd /opt/rocketmq-all-4.3.2-bin-release
2、修改rocketmq配置
3、调整rocketMq 的内存值,这一步很重要,根据服务器内存大小调整参数,要不然内存不够会启动不了或者死掉
vim bin/runbroker.sh
JAVA_OPT="${JAVA_OPT} -server -Xms512m -Xmx512m -Xmn512m"
JAVA_OPT="${JAVA_OPT} -XX:MaxDirectMemorySize=1g"
vim bin/runserver.sh
JAVA_OPT="${JAVA_OPT} -server -Xms1g -Xmx1g -Xmn1g -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=320m"
4、创建启动文件
vim startSrv
nohup sh ./bin/mqnamesrv -n IP:9876 > ./logs/rocketmqlogs/namesrv.log &
tail -f ./logs/rocketmqlogs/namesrv.log
vim startBroker
nohup sh bin/mqbroker -n IP:9876 > ./logs/rocketmqlogs/broker.log &
tail -f ./logs/rocketmqlogs/broker.log
vim stopSrv
sh bin/mqshutdown namesrv
vim stopBroker
sh bin/mqshutdown broker
5、注册话题
sh bin/mqadmin updateTopic -n ip:9876 -c DefaultCluster -t TOPIC_NAME
6、安装web管理界面 ##视具体情况而定,需要就安装
1) 下载安装包
wget https://github.com/apache/rocketmq-externals/archive/master.zip
2) 解压并配置修改配置文件
unzip master.zip ##解压后文件名为rocketmq-externals-master
cd rocketmq-externals-master
vim rocketmq-console/src/main/resources/application.properties
server.port=8080 #设置访问端口
rocketmq.config.namesrvAddr=IP:9876 #设置rocket的IP和端口
rocketmq.config.dataPath=/tmp/rocketmq-console/data #数据保存的路径
3) 编译rocketmq-console
cd rocketmq-externals-master/rocketmq-console #在这个目录下进行编译
mvn clean package -Dmaven.test.skip=true #编译完成后,会在target目录下生成rocketmq-console-ng-1.0.1.jar
4) 运行jar包
java -jar rocketmq-console-ng-1.0.1.jar
5) 浏览器访问
http://ip:8080/