1.安裝JDK
1.1 檢查當(dāng)前虛擬機(jī)環(huán)境有沒有JDK rpm -qa|grep java
1.2 卸載 rpm -e --nodeps xxxxxx(自己的openjdk)
1.3 安裝JDK
在/usr/local新建一個(gè)java文件夾,然后將tar包上傳到文件夾下
切換到/usr/local/java 使用tar -zxvf xxx解壓
配置/etc/profile文件,加入JDK環(huán)境變量
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
應(yīng)用文件 source /etc/profile
使用java -version查看版本
2.安裝RocketMQ
2.1 配置/etc/hosts文件,網(wǎng)址寫倆臺(tái)主機(jī)的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 重啟網(wǎng)卡 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 創(chuàng)建軟連接
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 對(duì)應(yīng)文件名稱
namesrvAddr=rocketmq-nameserver1:9876;rocketmq-nameserver2:9876
master02配置borker-b.properties
brokerName=broker-b 對(duì)應(yīng)文件名稱
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參數(shù),根據(jù)自己虛擬機(jī)實(shí)際大小修改
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 啟動(dòng)NameServer
cd /usr/local/rocketmq/bin
啟動(dòng):nohup sh mqnamesrv &
jps查看JDK進(jìn)程是否有NamesrvStartup
2.13 啟動(dòng)BrokerServer
cd /usr/local/rocketmq/bin
master01啟動(dòng):nohup sh mqbroker -c /usr/local/rocketmq/conf/2m-noslave/broker-a.properties >/dev/null 2>&1 &
master02啟動(dòng):nohup sh mqbroker -c /usr/local/rocketmq/conf/2m-noslave/broker-b.properties >/dev/null 2>&1 &
jps查看JDK進(jìn)程是否有BrokerStartup
3.通過console控制臺(tái)監(jiān)控rocketmq狀態(tài)
3.1 將Tomcat壓縮包上傳到虛擬機(jī)進(jìn)行解壓 /usr/local tar -zxvf xxxx解壓
3.2 將rocketmq-web-console.war上傳到Tomcat解壓目錄的webapps下
3.3 啟動(dòng)Tomcat
切換到/usr/local/apache-tomcat-7.0.65/bin
./startup.sh 啟動(dòng) ./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 兩臺(tái)機(jī)器防火墻關(guān)閉
systemctl stop firewalld.service
systemctl disable firewalld.service
配置完成后網(wǎng)頁訪問控制臺(tái),效果如下
以上就是本次介紹的全部相關(guān)知識(shí)點(diǎn)內(nèi)容,大家可以跟著學(xué)習(xí)下,感謝對(duì)腳本之家的支持。