1. 安装JDK
1.1 检查当前虚拟机环境有没有JDK rpm -qa|grep java
1.2 卸载 rpm -e --nodeps xxxxxx
1.3 安装JDK
在/usr/local新建一个java文件夹,然后将tar包上传到文件夹下
1.4 切换到java目录 解压压缩包
1.5 配置/etc/profile文件,加入JDK环境变量】、
export JAVA_HOME=/usr/local/java/jdk1.8.0_121 替换自己路径
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$JAVA_HOME/bin:$PATH
1.6 应用文件
1.7 使用java -version查看版本
2. 安装RocketMQ
2.1 配置/etc/hosts文件
2.2 重启网卡
2.3 上传rocketmq压缩包,上传到/usr/local下 并解压
2.4 更改解压文件夹名称mv alibaba-rocketmq alibaba-rocketmq-3.2.6
2.5 创建软连接 ln -s alibaba-rocketmq-3.2.6 rocketmq
2.6
mkdir /usr/local/rocketmq/store
mkdir /usr/local/rocketmq/store/commitlog
mkdir /usr/local/rocketmq/store/consumequeue
mkdir /usr/local/rocketmq/store/index
2.7 把borker-a.properties 和borker-b.properties 上传到/usr/local/recketmq/conf/2m-noslave
2.8 master01配置borker-a.properties
brokerName=broker-a 对应文件名称
namesrvAddr=rocketmq-nameserver1:9876;rocketmq-nameserver2:9876
master02配置borker-b.properties
brokerName=broker-b 对应文件名称
namesrvAddr=rocketmq-nameserver1:9876;rocketmq-nameserver2:9876
2.10 修改mkdir -p /usr/local/rocketmq/logs
cd /usr/local/rocketmq/conf && sed -i 's#${user.home}#/usr/local/rocketmq#g' *.xml
2.11
配置JVM参数
vi /usr/local/rocketmq/bin/runbroker.sh
JAVA_OPT="${JAVA_OPT} -server -Xms1g -Xmx1g -Xmn512m -XX:PermSize=128m -XX:MaxPermSize=320m"
vi /usr/local/rocketmq/bin/runserver.sh
2.12
启动NameServer
cd /usr/local/rocketmq/bin
启动:nohup sh mqnamesrv &
jps查看JDK进程是否有NamesrvStartup
2.13 启动BrokerServer
cd /usr/local/rocketmq/bin
master01启动:nohup sh mqbroker -c /usr/local/rocketmq/conf/2m-noslave/broker-a.properties >/dev/null 2>&1 &
master01启动:nohup sh mqbroker -c /usr/local/rocketmq/conf/2m-noslave/broker-b.properties >/dev/null 2>&1 &
jps查看JDK进程是否有BrokerStartup
3.通过console控制台监控rocketmq状态
3.1 将Tomcat压缩包上传到虚拟机进行解压 /usr/local tar -zxvf xxxx解压
3.2 将rocketmq-web-console.war上传到Tomcat解压目录的webapps下
3.3
启动Tomcat
切换到/usr/local/apache-tomcat-7.0.65/bin
./startup.sh 启动 ./shutdown.sh 停止
3.4
修改解压后的rocketmq-web-console
/usr/local/apache-tomcat-7.0.65/webapps/rocketmq-web-console/WEB-INF/classes/config.properties配置文件
配置:
rocketmq.namesrv.addr=192.168.7.11:9876;192.168.7.22:9876
throwDone=true
3.5 两台机器防火墙关闭
systemctl stop firewalld.service
systemctl disable firewalld.service
4.页面访问