刚才刚到了这篇https://www.orchome.com/1619 ,但是我这边是打开的,配置如下:
listeners=PLAINTEXT://172.16.0.93:9092
消费前输出如下:
[2019-07-25 14:47:34,604][org.apache.kafka.clients.consumer.ConsumerConfig:165] [INFO ] ConsumerConfig values:
metric.reporters = []
metadata.max.age.ms = 300000
value.deserializer = class org.apache.kafka.common.serialization.StringDeserializer
group.id = test
partition.assignment.strategy = [org.apache.kafka.clients.consumer.RangeAssignor]
reconnect.backoff.ms = 50
sasl.kerberos.ticket.renew.window.factor = 0.8
max.partition.fetch.bytes = 1048576
bootstrap.servers = [172.16.0.93:9092]
retry.backoff.ms = 100
sasl.kerberos.kinit.cmd = /usr/bin/kinit
sasl.kerberos.service.name = null
sasl.kerberos.ticket.renew.jitter = 0.05
ssl.keystore.type = JKS
ssl.trustmanager.algorithm = PKIX
enable.auto.commit = true
ssl.key.password = null
fetch.max.wait.ms = 500
sasl.kerberos.min.time.before.relogin = 60000
connections.max.idle.ms = 540000
ssl.truststore.password = null
session.timeout.ms = 30000
metrics.num.samples = 2
client.id =
ssl.endpoint.identification.algorithm = null
key.deserializer = class org.apache.kafka.common.serialization.StringDeserializer
ssl.protocol = TLS
check.crcs = true
request.timeout.ms = 40000
ssl.provider = null
ssl.enabled.protocols = [TLSv1.2, TLSv1.1, TLSv1]
ssl.keystore.location = null
heartbeat.interval.ms = 3000
auto.commit.interval.ms = 1000
receive.buffer.bytes = 32768
ssl.cipher.suites = null
ssl.truststore.type = JKS
security.protocol = PLAINTEXT
ssl.truststore.location = null
ssl.keystore.password = null
ssl.keymanager.algorithm = SunX509
metrics.sample.window.ms = 30000
fetch.min.bytes = 1
send.buffer.bytes = 131072
auto.offset.reset = latest
[2019-07-25 14:47:34,719][org.apache.kafka.common.utils.AppInfoParser:82] [INFO ] Kafka version : 0.9.0.1
[2019-07-25 14:47:34,719][org.apache.kafka.common.utils.AppInfoParser:83] [INFO ] Kafka commitId : 23c69d62a0cabf06
每一次都new一个新的consumer是因为需要监听不同的topic,同一个consumer可以切换不同的topic吗?
kafka消费者提交offset时,kafka集群正在重新分配消费者,就会报该错误。
kafka客户端自动是独立的线程,按间隔自动提交,当最后一次提交offset前,kafka消费者已经通知k8s关闭,释放了消费者的身份。
建议: