rocketmq

作者: 匿名用户xx | 来源:发表于2019-12-06 17:03 被阅读0次

单机rocketmq
一、安装jdk
二、安装rocketmq

useradd rocketmq;
unzip rocketmq-all-4.2.0-bin-release.zip -d /usr/local/rocketmq-4.2.0
chown -R rocketmq.rocketmq /usr/local/rocketmq-4.2.0

RocketMQ namesrv 启动

su rocketmq -c '/usr/local/rocketmq-4.2.0/bin/mqnamesrv &'
image.png

RocketMQ broker

单机只要启动一个broker

# broker-a
mkdir /usr/local/rocketmq-4.2.0/conf/broker-a/
cat > /usr/local/rocketmq-4.2.0/conf/broker-a/broker-a.properties <<EOF
brokerClusterName=post
brokerName=broker-a
brokerId=0
namesrvAddr= # 此处修改为namesrv地址,格式ip1:9876;ip2:9876;ip3:9876,此broker会向这些namesrv注册
brokerIP1= # 此处修改为运行broker的ec2 ip
listenPort=10911
deleteWhen=04
fileReservedTime=48
brokerRole=ASYNC_MASTER
flushDiskType=ASYNC_FLUSH
autoCreateTopicEnable=true
EOF

启动broker

su rocketmq -c '/usr/local/rocketmq-4.2.0/bin/mqbroker -c /usr/local/rocketmq-4.2.0/conf/broker-a/broker-a.properties &'

关闭
/usr/local/rocketmq-4.2.0/bin/mqshutdown broker
/usr/local/rocketmq-4.2.0/bin/mqshutdown namesrv

可能碰到的问题

1、如果启动不成功提示内存不足(error='Cannot allocate memory'),需要修改jvm配置

bin/runserver.sh
JAVA_OPT="${JAVA_OPT} -server -Xms512m -Xmx1500m -Xmn200m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=320m"

bin/runbroker.sh/
JAVA_OPT="${JAVA_OPT} -server -Xms512m -Xmx1500m -Xmn200m"

2、java.net.UnknownHostException: rocketmq: rocketmq: 未知的名称或服务
需要添加/etc/hosts配置文件中。127.0.0.1 rocketmq

rocketmq控制台

docker pull styletang/rocketmq-console-ng
docker run --name=rocketmq-console1 -e "JAVA_OPTS=-Drocketmq.namesrv.addr=内网ip:9876 -Dcom.rocketmq.sendMessageWithVIPChannel=false" -p 8080:8080 -t styletang/rocketmq-console-ng

http://192.168.51.193:8080/

[root@rocketmq ~]# docker ps
CONTAINER ID        IMAGE                           COMMAND                  CREATED             STATUS              PORTS                    NAMES
d433a4b27bb5        styletang/rocketmq-console-ng   "sh -c 'java $JAVA_O…"   58 seconds ago      Up 56 seconds       0.0.0.0:8080->8080/tcp   rocketmq-console1
image.png

相关文章

网友评论

      本文标题:rocketmq

      本文链接:https://www.haomeiwen.com/subject/jyyegctx.html