RocketMQ学习-01安装及环境配置
安装jdk环境
yum install java-1.8.0-openjdk
java -version
which java 输出 /usr/bin/java
#软连接
ls -l /usr/bin/java 输出 /usr/bin/java -> /etc/alternatives/java
ls -l /etc/alternatives/java --> 输出Java安装目录{JAVA_HOME}
配置jdk环境变量
export JAVA_HOME={JAVA_HOME}
export PATH=PATH:JAVA_HOME/bin
export CLASSPATH=.:$JAVA_HOME/lib
安装maven,(不知道为什么要再次登录才能使用wget命令)
wget http://repos.fedorapeople.org/repos/dchen/apache-maven/epel-apache-maven.repo -O /etc/yum.repos.d/epel-apache-maven.repo
yum -y install apache-maven
查找maven安装路径
#查找包路径
rpm -qa|grep apache-maven
#根据包路径查找安装目录
rpm -ql apache-maven-3.5.2-1.el7.noarch
#在搜索结果中就有maven的安装目录。
配置文件路径
#如果想修改拉取仓库
/etc/maven/settings.xml
安装RocketMQ
http://rocketmq.apache.org/docs/quick-start/
单机启动配置
- 修改nameserver和broker启动所需内存
- 启动nameserver:nohup sh bin/mqnamesrv -n xxx:9876 &
- 修改broker.conf配置后,启动broker:nohup sh bin/mqbroker -c conf/broker.conf &
broker.conf改为
brokerIP1=xxx
autoCreateTopicEnable=true
namesrvAddr=xxx:9876
brokerClusterName = DefaultCluster
brokerName = broker-a
brokerId = 0
deleteWhen = 04
fileReservedTime = 48
brokerRole = ASYNC_MASTER
flushDiskType = ASYNC_FLUSH
安装rocketmq-console
下载https://github.com/apache/rocketmq-externals
定位到rocketmq-console项目
修改:rocketmq.config.namesrvAddr=xxx:9876 (选择是否修改server.port=8082)
打包:mvn clean package -Dmaven.test.skip=true
上传到服务器启动:nohup java -jar rocketmq-console-ng-1.0.1.jar –server.port=8082 –rocketmq.config.namesrvAddr=xxx:9876 &