环境安装
- 先确保已经安装了jdk、maven
- 下载rocketMQ并且解压安装
// 安装包
https://mirror.bit.edu.cn/apache/rocketmq/4.7.0/rocketmq-all-4.7.0-bin-release.zip
// 源码
wget https://mirror.bit.edu.cn/apache/rocketmq/4.7.0/rocketmq-all-4.7.0-source-release.zip
unzip rocketmq-all-4.7.0-bin-release.zip
配置broker.conf
brokerIP1=XXXXXX
- 启动Name Server
守护进程方式启动name server
nohup sh mqnamesrv &
报错:
查看nohup.log日志,出现内存不足的情况。因为官方文件默认启动RocketMQ需要4G内存
// 修改runserver.sh
JAVA_OPT="${JAVA_OPT} -server -Xms256m -Xmx256m -Xmn125m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=320m"
// 修改runbroker.sh
JAVA_OPT="${JAVA_OPT} -server -Xms256m -Xmx256m -Xmn125m"
查看Name Server启动日志
[root@izbp1a2dsv8lw7ik396vokz bin]# tail -f nohup.out
Java HotSpot(TM) 64-Bit Server VM warning: Using the DefNew young collector with the CMS collector is deprecated and will likely be removed in a future release
Java HotSpot(TM) 64-Bit Server VM warning: UseCMSCompactAtFullCollection is deprecated and will likely be removed in a future release.
The Name Server boot success. serializeType=JSON
- 启动broker
nohup sh mqbroker -n xx.xx.xxx.xxx:9876 -c ../conf/broker.conf &
5.查看broker 启动日志
[root@izbp1a2dsv8lw7ik396vokz bin]# tail -f nohup.out
Java HotSpot(TM) 64-Bit Server VM warning: Using the DefNew young collector with the CMS collector is deprecated and will likely be removed in a future release
Java HotSpot(TM) 64-Bit Server VM warning: UseCMSCompactAtFullCollection is deprecated and will likely be removed in a future release.
The Name Server boot success. serializeType=JSON
The broker[izbp1a2dsv8lw7ik396vokz, 172.17.0.1:10911] boot success. serializeType=JSON and name server is 127.0.0.1:9876
结果:
[root@izbp1a2dsv8lw7ik396vokz ~]# jps -l
20096 sun.tools.jps.Jps
14773 io.elasticjob.lite.console.ConsoleBootstrap
19096 org.apache.rocketmq.namesrv.NamesrvStartup
27705 org.apache.zookeeper.server.quorum.QuorumPeerMain
19261 org.apache.rocketmq.broker.BrokerStartup
28094 elastic-job.jar
6.关闭nameserver broker执行的命令
mqshutdown namesrv
mqshutdown broker
网友评论