jdk11启动RocketMQ

2020-05-13

Apache RocketMQ™ is a unified messaging engine, lightweight data processing platform. Latest release v4.7.0

1、安装jdk11
2、安装rocketmq4.70
ver=4.7.0
yum -y install zip unzip
wget -c http://mirrors.tuna.tsinghua.edu.cn/apache/rocketmq/${ver}/rocketmq-all-${ver}-bin-release.zip -P /opt

unzip /opt/rocketmq-all-${ver}-bin-release.zip -d /jesong
rm -rf /opt/rocketmq
/bin/mv /opt/rocketmq-all-${ver}-bin-release /jesong/rocketmq

mkdir -p /opt/rocketmq/logs
mkdir -p /opt/rocketmq/store/{commitlog,consumequeue,index}

pushd /opt/rocketmq/conf
sed -i 's#${user.home}#/opt/rocketmq#g' *.xml
popd

3、修改runserver.sh和runbroker.sh变量CLASSPATH
export CLASSPATH=${BASE_DIR}/lib/rocketmq-broker-4.7.0.jar:${BASE_DIR}/lib/*:${BASE_DIR}/conf:${CLASSPATH}

4、修改内存占用
JAVA_OPT="${JAVA_OPT} -server -Xms512m -Xmx512m -Xmn128m -XX:MetaspaceSize=54m -XX:MaxMetaspaceSize=120m"

5、#support jdk11
pushd /jesong/rocketmq/bin
sed -i 's#-XX\:+UseConcMarkSweepGC##g' runserver.sh
sed -i 's#-XX\:+UseCMSCompactAtFullCollection##g' runserver.sh
sed -i 's#-XX\:+PrintGCDetails##g' runserver.sh
sed -i 's#-XX\:-UseParNewGC##g' runserver.sh
sed -i 's#-Xloggc\:#-Xlog\:gc\:#g' *.sh
sed -i 's#-XX\:+PrintGCDateStamps##g' runbroker.sh
sed -i 's#-XX\:+PrintGCApplicationStoppedTime##g' runbroker.sh
sed -i 's#-XX\:+PrintAdaptiveSizePolicy##g' runbroker.sh
sed -i 's#-XX\:+PrintGCDetails##g' runbroker.sh
sed -i '/UseGCLogFileRotation/d' *.sh
sed -i '/java.ext.dirs/d' *.sh
popd

6、创建启动脚本
cat << EOF >> 3shut_mqnamesrv.sh
cd /opt/rocketmq
sh bin/mqshutdown broker
sh bin/mqshutdown namesrv
EOF
cat << EOF >> 1start_rocketmq_namesrv_single.sh
#!/bin/sh
./bin/mqnamesrv -c conf/namesrv.properties &
EOF
cat << EOF >> cat 2start_broker.sh
#!/bin/sh
./bin/mqbroker -c conf/broker.conf &
EOF

7、修改启动端口
cat conf/namesrv.properties
listenPort=9040

cat conf/broker.conf
brokerIP1=172.16.61.143

8、4台mq集群启动
cat << EOF >> 2start_rocketmq.sh
cd /jesong/rocketmq
sh bin/mqnamesrv &
bin/mqbroker -c /jesong/rocketmq/conf/2m-2s-async/broker-a.properties &
#bin/mqbroker -c /jesong/rocketmq/conf/2m-2s-async/broker-a-s.properties &
#bin/mqbroker -c /jesong/rocketmq/conf/2m-2s-async/broker-b.properties &
#bin/mqbroker -c /jesong/rocketmq/conf/2m-2s-async/broker-b-s.properties &
EOF

cat << EOF >> 3shut_mqnamesrv.sh
cd /jesong/rocketmq
sh bin/mqshutdown broker
sh bin/mqshutdown namesrv
EOF

listenPort=9050

分类:数据库 | 标签: |

相关日志

评论被关闭!