【问题标题】:How to set the ConsumerTimestampsInterceptor in the ConsumerFactory?如何在 ConsumerFactory 中设置 ConsumerTimestampsInterceptor?
【发布时间】:2021-06-27 20:12:31
【问题描述】:

我有一个 Java spring boot Kafka 消费者应用程序,我被要求使用 confluent kafka 的“ConsumerTimestampsInterceptor”来支持 KAFKA 复制

我有下面的代码,但是它不起作用

    @Bean
    public ConsumerFactory<String, String> entConsumerFactory() {
        Map<String, Object> props = new HashMap<>();
        log.info("connecting to enterprise consumer bootstrap server" + entBootstrapAddress);
        props.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, entBootstrapAddress);
        log.info("using enterprise group id" + entGroupId);
        props.put(ConsumerConfig.GROUP_ID_CONFIG, entGroupId);
        props.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG,
                StringDeserializer.class);
        props.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG,
                StringDeserializer.class);
        props.put(JsonDeserializer.TRUSTED_PACKAGES, "*");

        props.put(ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG, "true");

// ConsumerTimestampsInterceptor: enables consumer applications to resume where they left off after a datacenter failover when using Confluent Replicator
    props.put(ConsumerConfig.INTERCEPTOR_CLASSES_CONFIG, "io.confluent.connect.replicator.offsets.ConsumerTimestampsInterceptor");
    props.put("timestamp.producer.security.protocol", "PLAINTEXT");
    props.put("timestamp.producer.sasl.mechanism", "NONE");

        return new DefaultKafkaConsumerFactory<>(props);
    }

它会引发以下警告

2021-04-01T00:44:32.367+05:30 [APP/PROC/WEB/0] [OUT] 2021-03-31 19:14:32.367 INFO 38 --- [http-nio-8080-exec-9] org.apache.kafka.clients.consumer.ConsumerConfig : ConsumerConfig values:
2021-04-01T00:44:32.367+05:30 [APP/PROC/WEB/0] [OUT] allow.auto.create.topics = true
2021-04-01T00:44:32.367+05:30 [APP/PROC/WEB/0] [OUT] auto.commit.interval.ms = 5000
2021-04-01T00:44:32.367+05:30 [APP/PROC/WEB/0] [OUT] auto.offset.reset = latest
2021-04-01T00:44:32.367+05:30 [APP/PROC/WEB/0] [OUT] bootstrap.servers = [17xxx:9092]
2021-04-01T00:44:32.367+05:30 [APP/PROC/WEB/0] [OUT] check.crcs = true
2021-04-01T00:44:32.367+05:30 [APP/PROC/WEB/0] [OUT] client.dns.lookup = default
2021-04-01T00:44:32.367+05:30 [APP/PROC/WEB/0] [OUT] client.id =
2021-04-01T00:44:32.367+05:30 [APP/PROC/WEB/0] [OUT] client.rack =
2021-04-01T00:44:32.367+05:30 [APP/PROC/WEB/0] [OUT] connections.max.idle.ms = 540000
2021-04-01T00:44:32.367+05:30 [APP/PROC/WEB/0] [OUT] default.api.timeout.ms = 60000
2021-04-01T00:44:32.367+05:30 [APP/PROC/WEB/0] [OUT] enable.auto.commit = true
2021-04-01T00:44:32.367+05:30 [APP/PROC/WEB/0] [OUT] exclude.internal.topics = true
2021-04-01T00:44:32.367+05:30 [APP/PROC/WEB/0] [OUT] fetch.max.bytes = 52428800
2021-04-01T00:44:32.367+05:30 [APP/PROC/WEB/0] [OUT] fetch.max.wait.ms = 500
2021-04-01T00:44:32.367+05:30 [APP/PROC/WEB/0] [OUT] fetch.min.bytes = 1
2021-04-01T00:44:32.367+05:30 [APP/PROC/WEB/0] [OUT] group.id = osps_dr
2021-04-01T00:44:32.367+05:30 [APP/PROC/WEB/0] [OUT] group.instance.id = null
2021-04-01T00:44:32.367+05:30 [APP/PROC/WEB/0] [OUT] heartbeat.interval.ms = 3000
2021-04-01T00:44:32.367+05:30 [APP/PROC/WEB/0] [OUT] interceptor.classes = [io.confluent.connect.replicator.offsets.ConsumerTimestampsInterceptor]
2021-04-01T00:44:32.367+05:30 [APP/PROC/WEB/0] [OUT] internal.leave.group.on.close = true
2021-04-01T00:44:32.367+05:30 [APP/PROC/WEB/0] [OUT] isolation.level = read_uncommitted
2021-04-01T00:44:32.367+05:30 [APP/PROC/WEB/0] [OUT] key.deserializer = class org.apache.kafka.common.serialization.StringDeserializer
2021-04-01T00:44:32.367+05:30 [APP/PROC/WEB/0] [OUT] max.partition.fetch.bytes = 1048576
2021-04-01T00:44:32.367+05:30 [APP/PROC/WEB/0] [OUT] max.poll.interval.ms = 300000
2021-04-01T00:44:32.367+05:30 [APP/PROC/WEB/0] [OUT] max.poll.records = 500
2021-04-01T00:44:32.367+05:30 [APP/PROC/WEB/0] [OUT] metadata.max.age.ms = 300000
2021-04-01T00:44:32.367+05:30 [APP/PROC/WEB/0] [OUT] metric.reporters = []
2021-04-01T00:44:32.367+05:30 [APP/PROC/WEB/0] [OUT] metrics.num.samples = 2
2021-04-01T00:44:32.367+05:30 [APP/PROC/WEB/0] [OUT] metrics.recording.level = INFO
2021-04-01T00:44:32.367+05:30 [APP/PROC/WEB/0] [OUT] metrics.sample.window.ms = 30000
2021-04-01T00:44:32.367+05:30 [APP/PROC/WEB/0] [OUT] partition.assignment.strategy = [class org.apache.kafka.clients.consumer.RangeAssignor]
2021-04-01T00:44:32.367+05:30 [APP/PROC/WEB/0] [OUT] receive.buffer.bytes = 65536
2021-04-01T00:44:32.367+05:30 [APP/PROC/WEB/0] [OUT] reconnect.backoff.max.ms = 1000
2021-04-01T00:44:32.367+05:30 [APP/PROC/WEB/0] [OUT] reconnect.backoff.ms = 50
2021-04-01T00:44:32.367+05:30 [APP/PROC/WEB/0] [OUT] request.timeout.ms = 30000
2021-04-01T00:44:32.367+05:30 [APP/PROC/WEB/0] [OUT] retry.backoff.ms = 100
2021-04-01T00:44:32.367+05:30 [APP/PROC/WEB/0] [OUT] sasl.client.callback.handler.class = null
2021-04-01T00:44:32.367+05:30 [APP/PROC/WEB/0] [OUT] sasl.jaas.config = null
2021-04-01T00:44:32.367+05:30 [APP/PROC/WEB/0] [OUT] sasl.kerberos.kinit.cmd = /usr/bin/kinit
2021-04-01T00:44:32.367+05:30 [APP/PROC/WEB/0] [OUT] sasl.kerberos.min.time.before.relogin = 60000
2021-04-01T00:44:32.367+05:30 [APP/PROC/WEB/0] [OUT] sasl.kerberos.service.name = null
2021-04-01T00:44:32.367+05:30 [APP/PROC/WEB/0] [OUT] sasl.kerberos.ticket.renew.jitter = 0.05
2021-04-01T00:44:32.367+05:30 [APP/PROC/WEB/0] [OUT] sasl.kerberos.ticket.renew.window.factor = 0.8
2021-04-01T00:44:32.367+05:30 [APP/PROC/WEB/0] [OUT] sasl.login.callback.handler.class = null
2021-04-01T00:44:32.367+05:30 [APP/PROC/WEB/0] [OUT] sasl.login.class = null
2021-04-01T00:44:32.367+05:30 [APP/PROC/WEB/0] [OUT] sasl.login.refresh.buffer.seconds = 300
2021-04-01T00:44:32.367+05:30 [APP/PROC/WEB/0] [OUT] sasl.login.refresh.min.period.seconds = 60
2021-04-01T00:44:32.367+05:30 [APP/PROC/WEB/0] [OUT] sasl.login.refresh.window.factor = 0.8
2021-04-01T00:44:32.367+05:30 [APP/PROC/WEB/0] [OUT] sasl.login.refresh.window.jitter = 0.05
2021-04-01T00:44:32.367+05:30 [APP/PROC/WEB/0] [OUT] sasl.mechanism = GSSAPI
2021-04-01T00:44:32.367+05:30 [APP/PROC/WEB/0] [OUT] security.protocol = PLAINTEXT
2021-04-01T00:44:32.367+05:30 [APP/PROC/WEB/0] [OUT] send.buffer.bytes = 131072
2021-04-01T00:44:32.367+05:30 [APP/PROC/WEB/0] [OUT] session.timeout.ms = 10000
2021-04-01T00:44:32.367+05:30 [APP/PROC/WEB/0] [OUT] ssl.cipher.suites = null
2021-04-01T00:44:32.367+05:30 [APP/PROC/WEB/0] [OUT] ssl.enabled.protocols = [TLSv1.2, TLSv1.1, TLSv1]
2021-04-01T00:44:32.367+05:30 [APP/PROC/WEB/0] [OUT] ssl.endpoint.identification.algorithm = https
2021-04-01T00:44:32.367+05:30 [APP/PROC/WEB/0] [OUT] ssl.key.password = null
2021-04-01T00:44:32.367+05:30 [APP/PROC/WEB/0] [OUT] ssl.keymanager.algorithm = SunX509
2021-04-01T00:44:32.367+05:30 [APP/PROC/WEB/0] [OUT] ssl.keystore.location = null
2021-04-01T00:44:32.367+05:30 [APP/PROC/WEB/0] [OUT] ssl.keystore.password = null
2021-04-01T00:44:32.367+05:30 [APP/PROC/WEB/0] [OUT] ssl.keystore.type = JKS
2021-04-01T00:44:32.367+05:30 [APP/PROC/WEB/0] [OUT] ssl.protocol = TLS
2021-04-01T00:44:32.367+05:30 [APP/PROC/WEB/0] [OUT] ssl.provider = null
2021-04-01T00:44:32.367+05:30 [APP/PROC/WEB/0] [OUT] ssl.secure.random.implementation = null
2021-04-01T00:44:32.367+05:30 [APP/PROC/WEB/0] [OUT] ssl.trustmanager.algorithm = PKIX
2021-04-01T00:44:32.367+05:30 [APP/PROC/WEB/0] [OUT] ssl.truststore.location = null
2021-04-01T00:44:32.367+05:30 [APP/PROC/WEB/0] [OUT] ssl.truststore.password = null
2021-04-01T00:44:32.367+05:30 [APP/PROC/WEB/0] [OUT] ssl.truststore.type = JKS
2021-04-01T00:44:32.367+05:30 [APP/PROC/WEB/0] [OUT] value.deserializer = class org.apache.kafka.common.serialization.StringDeserializer
2021-04-01T00:44:32.367+05:30 [APP/PROC/WEB/0] [OUT]
2021-04-01T00:44:32.388+05:30 [APP/PROC/WEB/0] [OUT] 2021-03-31 19:14:32.388 INFO 38 --- [http-nio-8080-exec-9] org.apache.kafka.clients.admin.AdminClientConfig : AdminClientConfig values:
2021-04-01T00:44:32.388+05:30 [APP/PROC/WEB/0] [OUT] bootstrap.servers = [17xxxx:9092]
2021-04-01T00:44:32.388+05:30 [APP/PROC/WEB/0] [OUT] client.dns.lookup = default
2021-04-01T00:44:32.388+05:30 [APP/PROC/WEB/0] [OUT] client.id = consumer-1
2021-04-01T00:44:32.388+05:30 [APP/PROC/WEB/0] [OUT] connections.max.idle.ms = 300000
2021-04-01T00:44:32.388+05:30 [APP/PROC/WEB/0] [OUT] metadata.max.age.ms = 300000
2021-04-01T00:44:32.388+05:30 [APP/PROC/WEB/0] [OUT] metric.reporters = []
2021-04-01T00:44:32.388+05:30 [APP/PROC/WEB/0] [OUT] metrics.num.samples = 2
2021-04-01T00:44:32.388+05:30 [APP/PROC/WEB/0] [OUT] metrics.recording.level = INFO
2021-04-01T00:44:32.388+05:30 [APP/PROC/WEB/0] [OUT] metrics.sample.window.ms = 30000
2021-04-01T00:44:32.388+05:30 [APP/PROC/WEB/0] [OUT] receive.buffer.bytes = 65536
2021-04-01T00:44:32.388+05:30 [APP/PROC/WEB/0] [OUT] reconnect.backoff.max.ms = 1000
2021-04-01T00:44:32.388+05:30 [APP/PROC/WEB/0] [OUT] reconnect.backoff.ms = 50
2021-04-01T00:44:32.388+05:30 [APP/PROC/WEB/0] [OUT] request.timeout.ms = 120000
2021-04-01T00:44:32.388+05:30 [APP/PROC/WEB/0] [OUT] retries = 5
2021-04-01T00:44:32.388+05:30 [APP/PROC/WEB/0] [OUT] retry.backoff.ms = 100
2021-04-01T00:44:32.388+05:30 [APP/PROC/WEB/0] [OUT] sasl.client.callback.handler.class = null
2021-04-01T00:44:32.388+05:30 [APP/PROC/WEB/0] [OUT] sasl.jaas.config = null
2021-04-01T00:44:32.388+05:30 [APP/PROC/WEB/0] [OUT] sasl.kerberos.kinit.cmd = /usr/bin/kinit
2021-04-01T00:44:32.388+05:30 [APP/PROC/WEB/0] [OUT] sasl.kerberos.min.time.before.relogin = 60000
2021-04-01T00:44:32.388+05:30 [APP/PROC/WEB/0] [OUT] sasl.kerberos.service.name = null
2021-04-01T00:44:32.388+05:30 [APP/PROC/WEB/0] [OUT] sasl.kerberos.ticket.renew.jitter = 0.05
2021-04-01T00:44:32.388+05:30 [APP/PROC/WEB/0] [OUT] sasl.kerberos.ticket.renew.window.factor = 0.8
2021-04-01T00:44:32.388+05:30 [APP/PROC/WEB/0] [OUT] sasl.login.callback.handler.class = null
2021-04-01T00:44:32.388+05:30 [APP/PROC/WEB/0] [OUT] sasl.login.class = null
2021-04-01T00:44:32.388+05:30 [APP/PROC/WEB/0] [OUT] sasl.login.refresh.buffer.seconds = 300
2021-04-01T00:44:32.388+05:30 [APP/PROC/WEB/0] [OUT] sasl.login.refresh.min.period.seconds = 60
2021-04-01T00:44:32.388+05:30 [APP/PROC/WEB/0] [OUT] sasl.login.refresh.window.factor = 0.8
2021-04-01T00:44:32.388+05:30 [APP/PROC/WEB/0] [OUT] sasl.login.refresh.window.jitter = 0.05
2021-04-01T00:44:32.388+05:30 [APP/PROC/WEB/0] [OUT] sasl.mechanism = GSSAPI
2021-04-01T00:44:32.388+05:30 [APP/PROC/WEB/0] [OUT] security.protocol = PLAINTEXT
2021-04-01T00:44:32.388+05:30 [APP/PROC/WEB/0] [OUT] send.buffer.bytes = 131072
2021-04-01T00:44:32.388+05:30 [APP/PROC/WEB/0] [OUT] ssl.cipher.suites = null
2021-04-01T00:44:32.388+05:30 [APP/PROC/WEB/0] [OUT] ssl.enabled.protocols = [TLSv1.2, TLSv1.1, TLSv1]
2021-04-01T00:44:32.388+05:30 [APP/PROC/WEB/0] [OUT] ssl.endpoint.identification.algorithm = https
2021-04-01T00:44:32.388+05:30 [APP/PROC/WEB/0] [OUT] ssl.key.password = null
2021-04-01T00:44:32.388+05:30 [APP/PROC/WEB/0] [OUT] ssl.keymanager.algorithm = SunX509
2021-04-01T00:44:32.388+05:30 [APP/PROC/WEB/0] [OUT] ssl.keystore.location = null
2021-04-01T00:44:32.388+05:30 [APP/PROC/WEB/0] [OUT] ssl.keystore.password = null
2021-04-01T00:44:32.388+05:30 [APP/PROC/WEB/0] [OUT] ssl.keystore.type = JKS
2021-04-01T00:44:32.388+05:30 [APP/PROC/WEB/0] [OUT] ssl.protocol = TLS
2021-04-01T00:44:32.388+05:30 [APP/PROC/WEB/0] [OUT] ssl.provider = null
2021-04-01T00:44:32.388+05:30 [APP/PROC/WEB/0] [OUT] ssl.secure.random.implementation = null
2021-04-01T00:44:32.388+05:30 [APP/PROC/WEB/0] [OUT] ssl.trustmanager.algorithm = PKIX
2021-04-01T00:44:32.388+05:30 [APP/PROC/WEB/0] [OUT] ssl.truststore.location = null
2021-04-01T00:44:32.388+05:30 [APP/PROC/WEB/0] [OUT] ssl.truststore.password = null
2021-04-01T00:44:32.388+05:30 [APP/PROC/WEB/0] [OUT] ssl.truststore.type = JKS
2021-04-01T00:44:32.388+05:30 [APP/PROC/WEB/0] [OUT]
2021-04-01T00:44:32.446+05:30 [APP/PROC/WEB/0] [OUT] 2021-03-31 19:14:32.446 WARN 38 --- [http-nio-8080-exec-9] org.apache.kafka.clients.admin.AdminClientConfig : The configuration 'key.deserializer' was supplied but isn't a known config.
2021-04-01T00:44:32.446+05:30 [APP/PROC/WEB/0] [OUT] 2021-03-31 19:14:32.446 WARN 38 --- [http-nio-8080-exec-9] org.apache.kafka.clients.admin.AdminClientConfig : The configuration 'spring.json.trusted.packages' was supplied but isn't a known config.
2021-04-01T00:44:32.446+05:30 [APP/PROC/WEB/0] [OUT] 2021-03-31 19:14:32.446 WARN 38 --- [http-nio-8080-exec-9] org.apache.kafka.clients.admin.AdminClientConfig : The configuration 'value.deserializer' was supplied but isn't a known config.
2021-04-01T00:44:32.446+05:30 [APP/PROC/WEB/0] [OUT] 2021-03-31 19:14:32.446 WARN 38 --- [http-nio-8080-exec-9] org.apache.kafka.clients.admin.AdminClientConfig : The configuration 'enable.auto.commit' was supplied but isn't a known config.
2021-04-01T00:44:32.446+05:30 [APP/PROC/WEB/0] [OUT] 2021-03-31 19:14:32.446 WARN 38 --- [http-nio-8080-exec-9] org.apache.kafka.clients.admin.AdminClientConfig : The configuration 'group.id' was supplied but isn't a known config.
2021-04-01T00:44:32.446+05:30 [APP/PROC/WEB/0] [OUT] 2021-03-31 19:14:32.446 WARN 38 --- [http-nio-8080-exec-9] org.apache.kafka.clients.admin.AdminClientConfig : The configuration 'interceptor.classes' was supplied but isn't a known config.
2021-04-01T00:44:32.446+05:30 [APP/PROC/WEB/0] [OUT] 2021-03-31 19:14:32.446 WARN 38 --- [http-nio-8080-exec-9] org.apache.kafka.clients.admin.AdminClientConfig : The configuration 'timestamp.producer.security.protocol' was supplied but isn't a known config.
2021-04-01T00:44:32.446+05:30 [APP/PROC/WEB/0] [OUT] 2021-03-31 19:14:32.446 WARN 38 --- [http-nio-8080-exec-9] org.apache.kafka.clients.admin.AdminClientConfig : The configuration 'timestamp.producer.sasl.mechanism' was supplied but isn't a known config.
2021-04-01T00:44:32.449+05:30 [APP/PROC/WEB/0] [OUT] 2021-03-31 19:14:32.449 INFO 38 --- [http-nio-8080-exec-9] org.apache.kafka.common.utils.AppInfoParser : Kafka version: 2.3.1
2021-04-01T00:44:32.449+05:30 [APP/PROC/WEB/0] [OUT] 2021-03-31 19:14:32.449 INFO 38 --- [http-nio-8080-exec-9] org.apache.kafka.common.utils.AppInfoParser : Kafka commitId: 18a913733fb71c01
2021-04-01T00:44:32.449+05:30 [APP/PROC/WEB/0] [OUT] 2021-03-31 19:14:32.449 INFO 38 --- [http-nio-8080-exec-9] org.apache.kafka.common.utils.AppInfoParser : Kafka startTimeMs: 1617218072446
2021-04-01T00:44:32.452+05:30 [APP/PROC/WEB/0] [OUT] 2021-03-31 19:14:32.452 INFO 38 --- [http-nio-8080-exec-9] i.c.connect.replicator.util.ReplicatorAdminClient : Requesting metadata refresh after 1 new topics were added
2021-04-01T00:44:32.454+05:30 [APP/PROC/WEB/0] [OUT] 2021-03-31 19:14:32.454 INFO 38 --- [http-nio-8080-exec-9] i.c.c.r.offsets.ConsumerTimestampsWriterConfig : ConsumerTimestampsWriterConfig values:
2021-04-01T00:44:32.454+05:30 [APP/PROC/WEB/0] [OUT] timestamps.producer.max.per.partition = 2147483647
2021-04-01T00:44:32.454+05:30 [APP/PROC/WEB/0] [OUT] timestamps.producer.topic.blacklist = []
2021-04-01T00:44:32.454+05:30 [APP/PROC/WEB/0] [OUT] timestamps.producer.topic.regex = null
2021-04-01T00:44:32.454+05:30 [APP/PROC/WEB/0] [OUT] timestamps.producer.topic.whitelist = null
2021-04-01T00:44:32.454+05:30 [APP/PROC/WEB/0] [OUT] timestamps.topic.num.partitions = 50
2021-04-01T00:44:32.454+05:30 [APP/PROC/WEB/0] [OUT] timestamps.topic.replication.factor = 3
2021-04-01T00:44:32.454+05:30 [APP/PROC/WEB/0] [OUT]
2021-04-01T00:44:32.712+05:30 [APP/PROC/WEB/0] [OUT] 2021-03-31 19:14:32.712 INFO 38 --- [http-nio-8080-exec-9] org.apache.kafka.clients.producer.ProducerConfig : ProducerConfig values:
2021-04-01T00:44:32.712+05:30 [APP/PROC/WEB/0] [OUT] acks = all
2021-04-01T00:44:32.712+05:30 [APP/PROC/WEB/0] [OUT] batch.size = 16384
2021-04-01T00:44:32.712+05:30 [APP/PROC/WEB/0] [OUT] bootstrap.servers = [17xxxx:9092]
2021-04-01T00:44:32.712+05:30 [APP/PROC/WEB/0] [OUT] buffer.memory = 33554432
2021-04-01T00:44:32.712+05:30 [APP/PROC/WEB/0] [OUT] client.dns.lookup = default
2021-04-01T00:44:32.712+05:30 [APP/PROC/WEB/0] [OUT] client.id = consumer-1
2021-04-01T00:44:32.712+05:30 [APP/PROC/WEB/0] [OUT] compression.type = lz4
2021-04-01T00:44:32.712+05:30 [APP/PROC/WEB/0] [OUT] connections.max.idle.ms = 540000
2021-04-01T00:44:32.712+05:30 [APP/PROC/WEB/0] [OUT] delivery.timeout.ms = 2147483647
2021-04-01T00:44:32.712+05:30 [APP/PROC/WEB/0] [OUT] enable.idempotence = false
2021-04-01T00:44:32.712+05:30 [APP/PROC/WEB/0] [OUT] interceptor.classes = []
2021-04-01T00:44:32.712+05:30 [APP/PROC/WEB/0] [OUT] key.serializer = class io.confluent.connect.replicator.offsets.GroupTopicPartitionSerializer
2021-04-01T00:44:32.712+05:30 [APP/PROC/WEB/0] [OUT] linger.ms = 500
2021-04-01T00:44:32.712+05:30 [APP/PROC/WEB/0] [OUT] max.block.ms = 60000
2021-04-01T00:44:32.712+05:30 [APP/PROC/WEB/0] [OUT] max.in.flight.requests.per.connection = 1
2021-04-01T00:44:32.712+05:30 [APP/PROC/WEB/0] [OUT] max.request.size = 10485760
2021-04-01T00:44:32.712+05:30 [APP/PROC/WEB/0] [OUT] metadata.max.age.ms = 300000
2021-04-01T00:44:32.712+05:30 [APP/PROC/WEB/0] [OUT] metric.reporters = []
2021-04-01T00:44:32.712+05:30 [APP/PROC/WEB/0] [OUT] metrics.num.samples = 2
2021-04-01T00:44:32.712+05:30 [APP/PROC/WEB/0] [OUT] metrics.recording.level = INFO
2021-04-01T00:44:32.712+05:30 [APP/PROC/WEB/0] [OUT] metrics.sample.window.ms = 30000
2021-04-01T00:44:32.712+05:30 [APP/PROC/WEB/0] [OUT] partitioner.class = class org.apache.kafka.clients.producer.internals.DefaultPartitioner
2021-04-01T00:44:32.712+05:30 [APP/PROC/WEB/0] [OUT] receive.buffer.bytes = 32768
2021-04-01T00:44:32.712+05:30 [APP/PROC/WEB/0] [OUT] reconnect.backoff.max.ms = 1000
2021-04-01T00:44:32.712+05:30 [APP/PROC/WEB/0] [OUT] reconnect.backoff.ms = 50
2021-04-01T00:44:32.712+05:30 [APP/PROC/WEB/0] [OUT] request.timeout.ms = 30000
2021-04-01T00:44:32.712+05:30 [APP/PROC/WEB/0] [OUT] retries = 2147483647
2021-04-01T00:44:32.712+05:30 [APP/PROC/WEB/0] [OUT] retry.backoff.ms = 500
2021-04-01T00:44:32.712+05:30 [APP/PROC/WEB/0] [OUT] sasl.client.callback.handler.class = null
2021-04-01T00:44:32.712+05:30 [APP/PROC/WEB/0] [OUT] sasl.jaas.config = null
2021-04-01T00:44:32.712+05:30 [APP/PROC/WEB/0] [OUT] sasl.kerberos.kinit.cmd = /usr/bin/kinit
2021-04-01T00:44:32.712+05:30 [APP/PROC/WEB/0] [OUT] sasl.kerberos.min.time.before.relogin = 60000
2021-04-01T00:44:32.712+05:30 [APP/PROC/WEB/0] [OUT] sasl.kerberos.service.name = null
2021-04-01T00:44:32.712+05:30 [APP/PROC/WEB/0] [OUT] sasl.kerberos.ticket.renew.jitter = 0.05
2021-04-01T00:44:32.712+05:30 [APP/PROC/WEB/0] [OUT] sasl.kerberos.ticket.renew.window.factor = 0.8
2021-04-01T00:44:32.712+05:30 [APP/PROC/WEB/0] [OUT] sasl.login.callback.handler.class = null
2021-04-01T00:44:32.712+05:30 [APP/PROC/WEB/0] [OUT] sasl.login.class = null
2021-04-01T00:44:32.712+05:30 [APP/PROC/WEB/0] [OUT] sasl.login.refresh.buffer.seconds = 300
2021-04-01T00:44:32.712+05:30 [APP/PROC/WEB/0] [OUT] sasl.login.refresh.min.period.seconds = 60
2021-04-01T00:44:32.712+05:30 [APP/PROC/WEB/0] [OUT] sasl.login.refresh.window.factor = 0.8
2021-04-01T00:44:32.712+05:30 [APP/PROC/WEB/0] [OUT] sasl.login.refresh.window.jitter = 0.05
2021-04-01T00:44:32.712+05:30 [APP/PROC/WEB/0] [OUT] sasl.mechanism = GSSAPI
2021-04-01T00:44:32.712+05:30 [APP/PROC/WEB/0] [OUT] security.protocol = PLAINTEXT
2021-04-01T00:44:32.712+05:30 [APP/PROC/WEB/0] [OUT] send.buffer.bytes = 131072
2021-04-01T00:44:32.712+05:30 [APP/PROC/WEB/0] [OUT] ssl.cipher.suites = null
2021-04-01T00:44:32.712+05:30 [APP/PROC/WEB/0] [OUT] ssl.enabled.protocols = [TLSv1.2, TLSv1.1, TLSv1]
2021-04-01T00:44:32.712+05:30 [APP/PROC/WEB/0] [OUT] ssl.endpoint.identification.algorithm = https
2021-04-01T00:44:32.712+05:30 [APP/PROC/WEB/0] [OUT] ssl.key.password = null
2021-04-01T00:44:32.712+05:30 [APP/PROC/WEB/0] [OUT] ssl.keymanager.algorithm = SunX509
2021-04-01T00:44:32.712+05:30 [APP/PROC/WEB/0] [OUT] ssl.keystore.location = null
2021-04-01T00:44:32.712+05:30 [APP/PROC/WEB/0] [OUT] ssl.keystore.password = null
2021-04-01T00:44:32.712+05:30 [APP/PROC/WEB/0] [OUT] ssl.keystore.type = JKS
2021-04-01T00:44:32.712+05:30 [APP/PROC/WEB/0] [OUT] ssl.protocol = TLS
2021-04-01T00:44:32.712+05:30 [APP/PROC/WEB/0] [OUT] ssl.provider = null
2021-04-01T00:44:32.712+05:30 [APP/PROC/WEB/0] [OUT] ssl.secure.random.implementation = null
2021-04-01T00:44:32.712+05:30 [APP/PROC/WEB/0] [OUT] ssl.trustmanager.algorithm = PKIX
2021-04-01T00:44:32.712+05:30 [APP/PROC/WEB/0] [OUT] ssl.truststore.location = null
2021-04-01T00:44:32.712+05:30 [APP/PROC/WEB/0] [OUT] ssl.truststore.password = null
2021-04-01T00:44:32.712+05:30 [APP/PROC/WEB/0] [OUT] ssl.truststore.type = JKS
2021-04-01T00:44:32.712+05:30 [APP/PROC/WEB/0] [OUT] transaction.timeout.ms = 60000
2021-04-01T00:44:32.712+05:30 [APP/PROC/WEB/0] [OUT] transactional.id = null
2021-04-01T00:44:32.712+05:30 [APP/PROC/WEB/0] [OUT] value.serializer = class io.confluent.connect.replicator.offsets.TimestampAndDeltaSerializer
2021-04-01T00:44:32.712+05:30 [APP/PROC/WEB/0] [OUT]
2021-04-01T00:44:32.744+05:30 [APP/PROC/WEB/0] [OUT] 2021-03-31 19:14:32.744 WARN 38 --- [http-nio-8080-exec-9] org.apache.kafka.clients.producer.ProducerConfig : The configuration 'key.deserializer' was supplied but isn't a known config.
2021-04-01T00:44:32.744+05:30 [APP/PROC/WEB/0] [OUT] 2021-03-31 19:14:32.744 WARN 38 --- [http-nio-8080-exec-9] org.apache.kafka.clients.producer.ProducerConfig : The configuration 'value.deserializer' was supplied but isn't a known config.
2021-04-01T00:44:32.744+05:30 [APP/PROC/WEB/0] [OUT] 2021-03-31 19:14:32.744 WARN 38 --- [http-nio-8080-exec-9] org.apache.kafka.clients.producer.ProducerConfig : The configuration 'group.id' was supplied but isn't a known config.
2021-04-01T00:44:32.744+05:30 [APP/PROC/WEB/0] [OUT] 2021-03-31 19:14:32.744 WARN 38 --- [http-nio-8080-exec-9] org.apache.kafka.clients.producer.ProducerConfig : The configuration 'spring.json.trusted.packages' was supplied but isn't a known config.
2021-04-01T00:44:32.745+05:30 [APP/PROC/WEB/0] [OUT] 2021-03-31 19:14:32.744 WARN 38 --- [http-nio-8080-exec-9] org.apache.kafka.clients.producer.ProducerConfig : The configuration 'enable.auto.commit' was supplied but isn't a known config.
2021-04-01T00:44:32.745+05:30 [APP/PROC/WEB/0] [OUT] 2021-03-31 19:14:32.744 WARN 38 --- [http-nio-8080-exec-9] org.apache.kafka.clients.producer.ProducerConfig : The configuration 'timestamp.producer.security.protocol' was supplied but isn't a known config.
2021-04-01T00:44:32.745+05:30 [APP/PROC/WEB/0] [OUT] 2021-03-31 19:14:32.744 WARN 38 --- [http-nio-8080-exec-9] org.apache.kafka.clients.producer.ProducerConfig : The configuration 'timestamp.producer.sasl.mechanism' was supplied but isn't a known config.

Primary KAFKA 集群中的状态

Secondary KAFKA 集群中的状态

理想情况下,Primary 和 Secondary KAFKA 集群中的偏移量应该是同步的,但不会发生。

我错过了什么?

注意:我有另一个使用以下配置的简单应用程序,并且 ConsumerTimestampsInterceptor 适用于该应用程序。

spring:
  kafka:
    properties:
      bootstrap.servers: ${vcap.services.sp-kv.credentials.kafkaservers}
    consumer:
      properties:
        interceptor:
          classes: io.confluent.connect.replicator.offsets.ConsumerTimestampsInterceptor
        timestamp:
          producer:
            security:
              protocol: PLAINTEXT
            sasl:
              mechanism: NONE

【问题讨论】:

    标签: apache-kafka spring-kafka interceptor confluent-platform


    【解决方案1】:

    拦截器应用正常。

    &gt;2021-04-01T00:44:32.367+05:30 [APP/PROC/WEB/0] [OUT] interceptor.classes = [io.confluent.connect.replicator.offsets.ConsumerTimestampsInterceptor].

    您可以忽略那些 WARN 日志;这只是关于未知配置的AdminClientConfig 警告;您似乎已将消费者配置应用于AdminClient。也许是拦截器本身。

    [[开始猜测]]

    我不熟悉拦截器,但我猜在故障转移之前会更正偏移量。看起来它正在写入__consumer_timestamps 主题。

    大概它稍后会使用它来同步正确的偏移量。

    [[结束猜测]]

    【讨论】:

    • 是的,它写入“__consumer_timestamps”主题,该主题由复制器读取以同步偏移量,但偏移量未同步,导致 Kafka 集群之间的偏移量不平衡。如果应用了拦截器,它应该同步偏移量。不确定错过了什么?
    • 嗯,问题是关于如何设置拦截器,这是正确的。既然您知道消费者已经获得了拦截器,那么您最好提出一个更有针对性的关于复制机制的问题。
    【解决方案2】:

    Primary KAFKA cluster 和 Secondary KAFKA cluster 中的偏移量不同。如果您使用压缩主题,Primary KC 中的偏移量将大于 Secondary KC 中的偏移量。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-02-07
      • 2018-07-29
      • 2019-05-26
      • 1970-01-01
      • 2012-06-07
      • 1970-01-01
      • 2021-09-27
      相关资源
      最近更新 更多