You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@rocketmq.apache.org by GitBox <gi...@apache.org> on 2020/12/04 05:51:39 UTC

[GitHub] [rocketmq] 418545106 opened a new issue #2484: 在同一台服务器上配置1主1从的broker,主broker下线,从broker不能把未消费完的消息发给消费端

418545106 opened a new issue #2484:
URL: https://github.com/apache/rocketmq/issues/2484


   主broker
   ```conf
   #所属集群名字
   brokerClusterName=DefaultCluster
   
   #broker名字,注意此处不同的配置文件填写的不一样,如果在broker-a.properties使用:broker-a,
   #在broker-b.properties使用:broker-b
   brokerName=broker-a
   
   #0 表示Master,>0 表示Slave
   brokerId=0
   
   #nameServer地址,分号分割
   #namesrvAddr=rocketmq-nameserver1:9876;rocketmq-nameserver2:9876
   
   #启动IP,如果 docker 报 com.alibaba.rocketmq.remoting.exception.RemotingConnectException: connect to <192.168.0.120:10909> failed
   # 解决方式1 加上一句producer.setVipChannelEnabled(false);,解决方式2 brokerIP1 设置宿主机IP,不要使用docker 内部IP
   brokerIP1=192.168.2.67
   
   #存在主从 broker 时,如果在 broker 主节点上配置了 brokerIP2 属性,broker 从节点会连接主节点配置的 brokerIP2 进行同步
   #brokerIP2=192.168.2.67
   
   #在发送消息时,自动创建服务器不存在的topic,默认创建的队列数
   defaultTopicQueueNums=4
   
   #是否允许 Broker 自动创建Topic,建议线下开启,线上关闭 !!!这里仔细看是false,false,false
   #原因下篇博客见~ 哈哈哈哈
   autoCreateTopicEnable=true
   
   #是否允许 Broker 自动创建订阅组,建议线下开启,线上关闭
   autoCreateSubscriptionGroup=true
   
   #Broker 对外服务的监听端口
   listenPort=10911
   
   #删除文件时间点,默认凌晨4点
   deleteWhen=04
   
   #文件保留时间,默认48小时
   fileReservedTime=120
   
   #commitLog每个文件的大小默认1G
   mapedFileSizeCommitLog=1073741824
   
   #ConsumeQueue每个文件默认存30W条,根据业务情况调整
   mapedFileSizeConsumeQueue=300000
   
   #destroyMapedFileIntervalForcibly=120000
   #redeleteHangedFileInterval=120000
   #检测物理文件磁盘空间
   diskMaxUsedSpaceRatio=88
   #存储路径
   #storePathRootDir=/home/ztztdata/rocketmq-all-4.1.0-incubating/store
   #commitLog 存储路径
   #storePathCommitLog=/home/ztztdata/rocketmq-all-4.1.0-incubating/store/commitlog
   #消费队列存储
   #storePathConsumeQueue=/home/ztztdata/rocketmq-all-4.1.0-incubating/store/consumequeue
   #消息索引存储路径
   #storePathIndex=/home/ztztdata/rocketmq-all-4.1.0-incubating/store/index
   #checkpoint 文件存储路径
   #storeCheckpoint=/home/ztztdata/rocketmq-all-4.1.0-incubating/store/checkpoint
   #abort 文件存储路径
   #abortFile=/home/ztztdata/rocketmq-all-4.1.0-incubating/store/abort
   #限制的消息大小
   maxMessageSize=65536
   
   #flushCommitLogLeastPages=4
   #flushConsumeQueueLeastPages=2
   #flushCommitLogThoroughInterval=10000
   #flushConsumeQueueThoroughInterval=60000
   
   #Broker 的角色
   #- ASYNC_MASTER 异步复制Master
   #- SYNC_MASTER 同步双写Master
   #- SLAVE
   brokerRole=SYNC_MASTER
   
   #刷盘方式
   #- ASYNC_FLUSH 异步刷盘
   #- SYNC_FLUSH 同步刷盘
   flushDiskType=ASYNC_FLUSH
   
   #发消息线程池数量
   #sendMessageThreadPoolNums=128
   #拉消息线程池数量
   #pullMessageThreadPoolNums=128
   
   #允许从读
   slaveReadEnable=true
   
   ```
   
   从broker
   ```
   #所属集群名字
   brokerClusterName=DefaultCluster
   
   #broker名字,注意此处不同的配置文件填写的不一样,如果在broker-a.properties使用:broker-a,
   #在broker-b.properties使用:broker-b
   brokerName=broker-a
   
   #0 表示Master,>0 表示Slave
   brokerId=1
   
   #nameServer地址,分号分割
   #namesrvAddr=rocketmq-nameserver1:9876;rocketmq-nameserver2:9876
   
   #启动IP,如果 docker 报 com.alibaba.rocketmq.remoting.exception.RemotingConnectException: connect to <192.168.0.120:10909> failed
   # 解决方式1 加上一句producer.setVipChannelEnabled(false);,解决方式2 brokerIP1 设置宿主机IP,不要使用docker 内部IP
   brokerIP1=192.168.2.67
   
   # 存在主从 broker 时,如果在 broker 主节点上配置了 brokerIP2 属性,broker 从节点会连接主节点配置的 brokerIP2 进行同步
   brokerIP2=192.168.2.67
   
   #在发送消息时,自动创建服务器不存在的topic,默认创建的队列数
   defaultTopicQueueNums=4
   
   #是否允许 Broker 自动创建Topic,建议线下开启,线上关闭 !!!这里仔细看是false,false,false
   #原因下篇博客见~ 哈哈哈哈
   autoCreateTopicEnable=true
   
   #是否允许 Broker 自动创建订阅组,建议线下开启,线上关闭
   autoCreateSubscriptionGroup=true
   
   #Broker 对外服务的监听端口
   listenPort=10921
   
   #删除文件时间点,默认凌晨4点
   deleteWhen=04
   
   #文件保留时间,默认48小时
   fileReservedTime=120
   
   #commitLog每个文件的大小默认1G
   mapedFileSizeCommitLog=1073741824
   
   #ConsumeQueue每个文件默认存30W条,根据业务情况调整
   mapedFileSizeConsumeQueue=300000
   
   #destroyMapedFileIntervalForcibly=120000
   #redeleteHangedFileInterval=120000
   #检测物理文件磁盘空间
   diskMaxUsedSpaceRatio=88
   #存储路径
   #storePathRootDir=/home/ztztdata/rocketmq-all-4.1.0-incubating/store
   #commitLog 存储路径
   #storePathCommitLog=/home/ztztdata/rocketmq-all-4.1.0-incubating/store/commitlog
   #消费队列存储
   #storePathConsumeQueue=/home/ztztdata/rocketmq-all-4.1.0-incubating/store/consumequeue
   #消息索引存储路径
   #storePathIndex=/home/ztztdata/rocketmq-all-4.1.0-incubating/store/index
   #checkpoint 文件存储路径
   #storeCheckpoint=/home/ztztdata/rocketmq-all-4.1.0-incubating/store/checkpoint
   #abort 文件存储路径
   #abortFile=/home/ztztdata/rocketmq-all-4.1.0-incubating/store/abort
   #限制的消息大小
   maxMessageSize=65536
   
   #flushCommitLogLeastPages=4
   #flushConsumeQueueLeastPages=2
   #flushCommitLogThoroughInterval=10000
   #flushConsumeQueueThoroughInterval=60000
   
   #Broker 的角色
   #- ASYNC_MASTER 异步复制Master
   #- SYNC_MASTER 同步双写Master
   #- SLAVE
   brokerRole=SLAVE
   
   #刷盘方式
   #- ASYNC_FLUSH 异步刷盘
   #- SYNC_FLUSH 同步刷盘
   flushDiskType=ASYNC_FLUSH
   
   #发消息线程池数量
   #sendMessageThreadPoolNums=128
   #拉消息线程池数量
   #pullMessageThreadPoolNums=128
   
   #允许从读
   slaveReadEnable=true
   
   ```
   操作步骤是,先让消息生产者生产100条消息,在主从broker接受完成消息
   ```log
   SendResult [sendStatus=SEND_OK, msgId=C0A8020E60A018B4AAC2126B1F330063, offsetMsgId=C0A8024300002A9F000000000000DED9, messageQueue=MessageQueue [topic=TopicOrder, brokerName=broker-a, queueId=0], queueOffset=299]
   13:50:10.245 [NettyClientSelector_1] INFO RocketmqRemoting - closeChannel: close the connection to remote address[192.168.2.67:9876] result: true
   13:50:10.248 [NettyClientSelector_1] INFO RocketmqRemoting - closeChannel: close the connection to remote address[192.168.2.67:10911] result: true
   13:50:10.248 [NettyClientSelector_1] INFO RocketmqRemoting - closeChannel: close the connection to remote address[192.168.2.67:10921] result: true
   ```
   随后让主broker下线,之后再启动消费者,slave-broker不会把这些未消费过的消息发送给消费者


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [rocketmq] RongtongJin commented on issue #2484: Consumers cannot consume from slave broker

Posted by GitBox <gi...@apache.org>.
RongtongJin commented on issue #2484:
URL: https://github.com/apache/rocketmq/issues/2484#issuecomment-738590668


   建议发送更多的消息,并等待消费者路由信息更新。


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [rocketmq] RongtongJin commented on issue #2484: Consumers cannot consume from slave broker

Posted by GitBox <gi...@apache.org>.
RongtongJin commented on issue #2484:
URL: https://github.com/apache/rocketmq/issues/2484#issuecomment-739117360


   > 我在尝试使用MessageListenerConcurrently类的消费模式时,在master down的情况下也会继续消费消息,但是在使用MessageListenerOrderly类消费的时候,就不会继续消费了,请问是在顺序消费时,内部为了顺序而导致slave无法消费的原因吗
   
   那就是正常的,顺序消息在消费Queue时需要加锁,且只能在Master节点上加锁。


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [rocketmq] RongtongJin closed issue #2484: Consumers cannot consume from slave broker

Posted by GitBox <gi...@apache.org>.
RongtongJin closed issue #2484:
URL: https://github.com/apache/rocketmq/issues/2484


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [rocketmq] 418545106 commented on issue #2484: Consumers cannot consume from slave broker

Posted by GitBox <gi...@apache.org>.
418545106 commented on issue #2484:
URL: https://github.com/apache/rocketmq/issues/2484#issuecomment-738597712


   我尝试完整循环发送10w条数据,亦或是在的循环途中让master-broker下线,但slave-broker在两种情况下都没有再继续对消费者发送给消息


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [rocketmq] 418545106 commented on issue #2484: Consumers cannot consume from slave broker

Posted by GitBox <gi...@apache.org>.
418545106 commented on issue #2484:
URL: https://github.com/apache/rocketmq/issues/2484#issuecomment-738763800


   我在尝试使用MessageListenerConcurrently类的消费模式时,在master down的情况下也会继续消费消息,但是在使用MessageListenerOrderly类消费的时候,就不会继续消费了,请问是在顺序消费时,内部为了顺序而导致slave无法消费的原因吗


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org