RocketMQ环境搭建(rocketmq 部署)

  本篇文章为你整理了RocketMQ环境搭建(rocketmq 部署)的详细内容,包含有rocketmq安装配置 rocketmq 部署 rocketmq环境变量配置 rocketmq搭建集群 RocketMQ环境搭建,希望能帮助你了解 RocketMQ环境搭建。

  服务器需要开放9876​、10909​、10911​三个端口

  下载二进制包:RocketMQ 并解压到指定目录

  

# 启动namesrv

 

  $ nohup sh bin/mqnamesrv

  # 验证namesrv是否启动成功

  $ tail -f ~/logs/rocketmqlogs/namesrv.log

  The Name Server boot success...

  # 先启动broker

  $ nohup sh bin/mqbroker -n localhost:9876

  # 验证broker是否启动成功, 比如, broker的ip是192.168.1.2 然后名字是broker-a

  $ tail -f ~/logs/rocketmqlogs/Broker.log

  The broker[broker-a,192.169.1.2:10911] boot success...

  

 

  

$ export NAMESRV_ADDR=localhost:9876

 

  $ sh bin/tools.sh org.apache.rocketmq.example.quickstart.Producer

   SendResult [sendStatus=SEND_OK, msgId= ...

  $ sh bin/tools.sh org.apache.rocketmq.example.quickstart.Consumer

   ConsumeMessageThread_%d Receive New Messages: [MessageExt...

  

 

  

$ sh bin/mqshutdown broker

 

  The mqbroker(36695) is running...

  Send shutdown request to mqbroker(36695) OK

  $ sh bin/mqshutdown namesrv

  The mqnamesrv(36664) is running...

  Send shutdown request to mqnamesrv(36664) OK

  

 

  问题一:在服务器上测试没问题,使用其他电脑测试报错

  

org.apache.rocketmq.remoting.exception.RemotingTooMuchRequestException: sendDefaultImpl call timeout

 

   at org.apache.rocketmq.client.impl.producer.DefaultMQProducerImpl.sendDefaultImpl(DefaultMQProducerImpl.java:634)

   at org.apache.rocketmq.client.impl.producer.DefaultMQProducerImpl.send(DefaultMQProducerImpl.java:1279)

   at org.apache.rocketmq.client.impl.producer.DefaultMQProducerImpl.send(DefaultMQProducerImpl.java:1225)

   at org.apache.rocketmq.client.producer.DefaultMQProducer.send(DefaultMQProducer.java:283)

   at org.apache.rocketmq.example.quickstart.Producer.main(Producer.java:67)

  09:59:04.727 [NettyClientSelector_1] INFO RocketmqRemoting - closeChannel: close the connection to remote address[] result: true

  

 

  测试一下9876​端口

  

$ nc -vz -w 2 192.168.0.254 9876 

 

  Connection to 192.168.0.254 port 9876 [tcp/sd] succeeded!

  

 

  端口是通的,没办法只能Google一下错误

  
重新启动broker,并指定conf/broker.conf​配置文件

  

nohup sh bin/mqbroker -n localhost:9876 -c conf/broker.conf 

 

  

 

  
问题二:内存占用过大,造成服务器卡顿

  启动RocketMQ后直接吃了6G内存,卡的服务器命令都执行不了了

  
修改bin/runserver.sh​

  

JAVA_OPT="${JAVA_OPT} -server -Xms256m -Xmx1024m -Xmn125m -XX:MetaspaceSize=1024m -XX:MaxMetaspaceSize=1024m"

 

  

 

  
修改bin/runbroker.sh​

  

JAVA_OPT="${JAVA_OPT} -server -Xms256m -Xmx1024m -Xmn125m"

 

  

 

  以上就是RocketMQ环境搭建(rocketmq 部署)的详细内容,想要了解更多 RocketMQ环境搭建的内容,请持续关注盛行IT软件开发工作室。

郑重声明:本文由网友发布,不代表盛行IT的观点,版权归原作者所有,仅为传播更多信息之目的,如有侵权请联系,我们将第一时间修改或删除,多谢。

留言与评论(共有 条评论)
   
验证码: