Kafka leader -1

问题错误日志:

21/03/28 10:17:06 WARN clients.NetworkClient: [Consumer clientId=consumer-1, groupId=kafka_loader_20210325] Con
nection to node 3 could not be established. Broker may not be available.
21/03/28 10:17:06 INFO internals.Fetcher: [Consumer clientId=consumer-1, groupId=kafka_loader_20210325] Resetti
ng offset for partition nb-EIP-SFA-database-0 to offset 138.
21/03/28 10:17:06 INFO internals.Fetcher: [Consumer clientId=consumer-1, groupId=kafka_loader_20210325] Resetti
ng offset for partition log_server_stream-0 to offset 0.
21/03/28 10:17:06 INFO internals.Fetcher: [Consumer clientId=consumer-1, groupId=kafka_loader_20210325] Resetti
ng offset for partition nb-EIP-DD-easysales_market-0 to offset 349915.
21/03/28 10:17:06 INFO internals.Fetcher: [Consumer clientId=consumer-1, groupId=kafka_loader_20210325] Resetti
ng offset for partition nb-EIP-DD-peoplesoft-0 to offset 0.
21/03/28 10:17:06 INFO internals.Fetcher: [Consumer clientId=consumer-1, groupId=kafka_loader_20210325] Resetti
ng offset for partition nb-EIP-DD-wechat-0 to offset 4588.
21/03/28 10:17:06 INFO internals.Fetcher: [Consumer clientId=consumer-1, groupId=kafka_loader_20210325] Resetti
ng offset for partition nb-EIP-DD-easysales_bpit-0 to offset 792559.
21/03/28 10:17:06 INFO internals.Fetcher: [Consumer clientId=consumer-1, groupId=kafka_loader_20210325] Resetti
ng offset for partition nb-EIP-DD-office365-0 to offset 1300090.
21/03/28 10:17:06 WARN clients.NetworkClient: [Consumer clientId=consumer-1, groupId=kafka_loader_20210325] Con
nection to node 3 could not be established. Broker may not be available.
21/03/28 10:17:06 WARN clients.NetworkClient: [Consumer clientId=consumer-1, groupId=kafka_loader_20210325] Con
nection to node 3 could not be established. Broker may not be available.
21/03/28 10:17:06 WARN clients.NetworkClient: [Consumer clientId=consumer-1, groupId=kafka_loader_20210325] Con
nection to node 3 could not be established. Broker may not be available.
21/03/28 10:17:07 WARN clients.NetworkClient: [Consumer clientId=consumer-1, groupId=kafka_loader_20210325] Con
nection to node 3 could not be established. Broker may not be available.
21/03/28 10:17:08 WARN clients.NetworkClient: [Consumer clientId=consumer-1, groupId=kafka_loader_20210325] Con
nection to node 3 could not be established. Broker may not be available.
21/03/28 10:17:09 WARN clients.NetworkClient: [Consumer clientId=consumer-1, groupId=kafka_loader_20210325] Con
nection to node 3 could not be established. Broker may not be available.
21/03/28 10:17:10 WARN clients.NetworkClient: [Consumer clientId=consumer-1, groupId=kafka_loader_20210325] Con
nection to node 3 could not be established. Broker may not be available.
21/03/28 10:17:11 WARN clients.NetworkClient: [Consumer clientId=consumer-1, groupId=kafka_loader_20210325] Con
nection to node 3 could not be established. Broker may not be available.
21/03/28 10:17:12 WARN clients.NetworkClient: [Consumer clientId=consumer-1, groupId=kafka_loader_20210325] Con
nection to node 3 could not be established. Broker may not be available.
21/03/28 10:17:13 WARN clients.NetworkClient: [Consumer clientId=consumer-1, groupId=kafka_loader_20210325] Con
nection to node 3 could not be established. Broker may not be available.
21/03/28 10:17:14 WARN clients.NetworkClient: [Consumer clientId=consumer-1, groupId=kafka_loader_20210325] Con
nection to node 3 could not be established. Broker may not be available.
21/03/28 10:17:15 WARN clients.NetworkClient: [Consumer clientId=consumer-1, groupId=kafka_loader_20210325] Con
nection to node 3 could not be established. Broker may not be available.
21/03/28 10:17:16 WARN clients.NetworkClient: [Consumer clientId=consumer-1, groupId=kafka_loader_20210325] Con
nection to node 3 could not be established. Broker may not be available.
21/03/28 10:17:17 WARN clients.NetworkClient: [Consumer clientId=consumer-1, groupId=kafka_loader_20210325] Con
nection to node 3 could not be established. Broker may not be available.
21/03/28 10:17:18 WARN clients.NetworkClient: [Consumer clientId=consumer-1, groupId=kafka_loader_20210325] Con
nection to node 3 could not be established. Broker may not be available.
21/03/28 10:17:19 WARN clients.NetworkClient: [Consumer clientId=consumer-1, groupId=kafka_loader_20210325] Con
nection to node 3 could not be established. Broker may not be available.

nection to node 3 could not be established. Broker may not be available.
21/03/28 10:17:58 WARN clients.NetworkClient: [Consumer clientId=consumer-1, groupId=kafka_loader_20210325] Con
nection to node 3 could not be established. Broker may not be available.
21/03/28 10:17:59 WARN clients.NetworkClient: [Consumer clientId=consumer-1, groupId=kafka_loader_20210325] Con
nection to node 3 could not be established. Broker may not be available.
21/03/28 10:18:00 WARN clients.NetworkClient: [Consumer clientId=consumer-1, groupId=kafka_loader_20210325] Con
nection to node 3 could not be established. Broker may not be available.
21/03/28 10:18:01 WARN clients.NetworkClient: [Consumer clientId=consumer-1, groupId=kafka_loader_20210325] Con
nection to node 3 could not be established. Broker may not be available.
21/03/28 10:18:02 WARN clients.NetworkClient: [Consumer clientId=consumer-1, groupId=kafka_loader_20210325] Con
nection to node 3 could not be established. Broker may not be available.
21/03/28 10:18:03 WARN clients.NetworkClient: [Consumer clientId=consumer-1, groupId=kafka_loader_20210325] Con
nection to node 3 could not be established. Broker may not be available.
21/03/28 10:18:04 WARN clients.NetworkClient: [Consumer clientId=consumer-1, groupId=kafka_loader_20210325] Con
nection to node 3 could not be established. Broker may not be available.
21/03/28 10:18:05 WARN clients.NetworkClient: [Consumer clientId=consumer-1, groupId=kafka_loader_20210325] Con
nection to node 3 could not be established. Broker may not be available.
21/03/28 10:18:06 ERROR streaming.StreamingContext: Error starting the context, marking it as stopped
org.apache.kafka.common.errors.TimeoutException: Timeout of 60000ms expired before the position for partition n
b-EIP-DD-master_shared-0 could be determined
        at ... run in separate thread using org.apache.spark.util.ThreadUtils ... ()
        at org.apache.spark.streaming.StreamingContext.liftedTree1$1(StreamingContext.scala:583)
        at org.apache.spark.streaming.StreamingContext.start(StreamingContext.scala:575)
        at com.mininglamp.eip.cona.scala.kafka.loader.spark.streaming.RunLoader$.main(RunLoader.scala:283)
        at com.mininglamp.eip.cona.scala.kafka.loader.spark.streaming.RunLoader.main(RunLoader.scala)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.apache.spark.deploy.yarn.ApplicationMaster$$anon$2.run(ApplicationMaster.scala:685)
21/03/28 10:18:06 INFO scheduler.ReceiverTracker: ReceiverTracker stopped
21/03/28 10:18:06 INFO scheduler.JobGenerator: Stopping JobGenerator immediately
21/03/28 10:18:06 INFO util.RecurringTimer: Stopped timer for JobGenerator after time -1
21/03/28 10:18:06 INFO scheduler.JobGenerator: Stopped JobGenerator

 

bin/kafka-topics.sh --describe --zookeeper ip:30001 --topic test
Topic: test      PartitionCount:2        ReplicationFactor:1     Configs:
        Topic: test Partition: 0    Leader: -1      Replicas: 3     Isr: 3
        Topic: test Partition: 1    Leader: 0       Replicas: 0     Isr: 0
        
发现这个topic的leader是: -1

方法1:
删除Topic,重新创建。

首先查看topic:

方法2:

直接修改:

set /brokers/topics/test/partitions/0/state {"controller_epoch":140,"leader":0,"version":1,"leader_epoch":12,"isr":[0]}
查看状态:
get /brokers/topics/test/partitions/0/state

{"controller_epoch":452,"leader":0,"version":1,"leader_epoch":3577,"isr":[0]}
cZxid = 0x4200000924
ctime = Thu Mar 25 17:14:38 CST 2021
mZxid = 0x4800002ee7
mtime = Sun Mar 28 13:37:08 CST 2021
pZxid = 0x4200000924
cversion = 0
dataVersion = 3578
aclVersion = 0
ephemeralOwner = 0x0
dataLength = 77
numChildren = 0

get /brokers/topics/test/partitions/1/state

 解决方案
直接修改zookeeper中该分区对应的state
PS:非常不建议只有1个副本
        
方法3: 修改topic的副本数量

        
创建一个json文件,内容如下:

{
  "version": 1,
  "partitions": [
    {
      "topic": "input_stream",
      "partition": 0,
      "replicas": [0]
    }
  ]
}
 
 

执行修改命令
 
bin/kafka-reassign-partitions.sh --zookeeper ip:30001 --reassignment-json-file /data/kafka_2.11-0.11.0.0/input_stream.json --execute
 
修改完成后稍等片刻即可生效

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值