RocketMQ 设置 brokerIP1 无效

RocketMQ 设置 brokerIP1 无效,默认会找到docker 的地址,导致无法连接到broker

配置:

2018-06-20 21\:00\:56 INFO main - namesrvAddr=127.0.0.1:9876
2018-06-20 21\:00\:56 INFO main - brokerIP1=127.0.0.1
2018-06-20 21\:00\:56 INFO main - brokerName=localhost.localdomain
2018-06-20 21\:00\:56 INFO main - brokerClusterName=DefaultCluster
2018-06-20 21\:00\:56 INFO main - brokerId=0

启动:

[Unit]
Description=RocketMQ-Broker
After=namesrv.service
[Service]
ExecStart=/opt/rocketmq/bin/mqbroker  -c /opt/rocketmq/conf/broker.p
ExecStop=/opt/rocketmq/bin/mqshutdown broker
[Install]
WantedBy=multi-user.target

日志:

2018-06-20 21:31:41 INFO PullRequestHoldService - PullRequestHoldService service started
2018-06-20 21:31:41 INFO main - The broker[localhost.localdomain, 172.17.0.1:10911] boot success. serializeType=JSON
2018-06-20 21:31:51 INFO BrokerControllerScheduledThread1 - dispatch behind commit log 0 bytes
2018-06-20 21:31:51 INFO BrokerControllerScheduledThread1 - Slave fall behind master: 0 bytes
阅读 10.3k
1 个回答

如果是在docker里使用rocketmq,建议看下官方文档,很详细https://github.com/apache/roc...

提供一个思路吧

# Start nameserver
docker run -d -p 9876:9876 -v `pwd`/data/namesrv/logs:/home/rocketmq/logs -v `pwd`/data/namesrv/store:/home/rocketmq/store --name rmqnamesrv rocketmqinc/rocketmq:4.5.0 sh mqnamesrv

# Start Broker
docker run -d -p 10911:10911 -p 10909:10909 -v `pwd`/data/broker/logs:/home/rocketmq/logs -v `pwd`/data/broker/store:/home/rocketmq/store -v `pwd`/data/broker/conf/broker.conf:/opt/rocketmq-4.5.0/conf/broker.conf --name rmqbroker --link rmqnamesrv:namesrv -e "NAMESRV_ADDR=namesrv:9876" rocketmqinc/rocketmq:4.5.0 sh mqbroker -c /opt/rocketmq-4.5.0/conf/broker.conf
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
宣传栏