背景

集群配置

Pulsar集群版本:2.8.0

Pulsar Broker节点数:3

Pulsar Bookies节点数:5

Pulsar Zookeeper节点数:3

因为消费者服务有问题,需要重启消费者服务 

现象

登陆到broker上去查看日志,只有一个broker节点上有些可疑的日志,不断的在打印这些日志

[pulsar-io-4-4] INFO  org.apache.pulsar.broker.lookup.TopicLookupBase - Failed to lookup null for topic persistent://base/message/delay_notify_service_pulsar_topic-partition-6 with error Namespace bundle base/message/0x2aaaaaaa_0x3fffffff is being unloaded

登陆到pulsar-manager控制台时,无法显示所创建的namespaces, 所创建的namespaces为:base/message/

pulsar 集群报错Failed to lookup null for topic_pulsar

所有消费者无法订阅到topic 上,消费者日志报错日志如下 

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'delayLevelTurnService': Invocation of init method failed; nested exception is org.apache.pulsar.client.api.PulsarClientException$LookupException: Namespace is being unloaded, cannot add topic persistent://base/message/delay_notify_service_pulsar_topic-partition-6
  at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:139) ~[spring-beans-5.0.13.RELEASE.jar:5.0.13.RELEASE]

 

解决方法

将集群中所有broker节点依次重启,消费者就能正常连接上来,登陆到pulsar-manager上,所创建的namespaces也能正常显示

pulsar 集群报错Failed to lookup null for topic_pulsar报错_02

原因

据官网的说法是因为broker上的cache数据与zookeeper集群上cache的数据不一致造成的。