服务器
1.安装JDK
1.1 检查当前虚拟机环境有没有JDK rpm -qa|grep java
1.2 卸载 rpm -e –nodeps xxxxxx(自己的openjdk)
1.3 安装JDK
在/usr/local新建一个java文件夹,然后将tar包上传到文件夹下
切换到/usr/local/java 使用tar -zxvf xxx解压
配置/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
应用文件 source /etc/profile
使用java -version查看版本
2.安装RocketMQ
2.1 配置/etc/hosts文件,网址写俩台主机的ip
192.168.42.22 rocketmq-nameserver1
192.168.42.22 rocketmq-master1
192.168.42.33 rocketmq-nameserver2
192.168.42.33 rocketmq-master2
2.2 重启网卡 service network restart
2.3 上传rocketmq压缩包,上传到/usr/local下
2.4 切换到/usr/local下解压rocketmq压缩包 tar -zxvf xxxxxx
2.5 更改解压文件夹名称
mv alibaba-rocketmq alibaba-rocketmq-3.2.6
2.6 创建软连接
ln -s alibaba-rocketmq-3.2.6 rocketmq
2.7 mkdir /usr/local/rocketmq/store
mkdir /usr/local/rocketmq/store/commitlog
mkdir /usr/local/rocketmq/store/consumequeue
mkdir /usr/local/rocketmq/store/index
2.8 把borker-a.properties 和borker-b.properties 上传到/usr/local/recketmq/conf/2m-noslave
2.9 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
JAVA_OPT=${JAVA_OPT} -server -Xms1g -Xmx1g -Xmn512m -XX:PermSize=128m -XX:MaxPermSize=320m
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 &
master02启动: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.42.22:9876;192.168.42.33:9876
throwDone=true
3.5 两台机器防火墙关闭
systemctl stop firewalld.service
systemctl disable firewalld.service
配置完成后网页访问控制台,效果如下
以上就是本次介绍的全部相关知识点内容,大家可以跟着学习下,感谢对亿速云的支持。