我目前正在使用基于Kafka的数据分析管道从源系统中摄取大量日志文件。在摄取期间,我不在生产者中使用任何类型的延迟/暂停,我只是从日志文件(包含JSON)中读取并将其发送到Kafka。我的制作人有以下配置。
metric.reporters = []
metadata.max.age.ms = 300000
reconnect.backoff.ms = 50
sasl.kerberos.ticket.renew.window.factor = 0.8
bootstrap.servers = [1.2.3.184:9092, 1.2.3.185:9092, 1.2.3.186:9092]
ssl.keystore.type = JKS
sasl.mechanism = GSSAPI
max.block.ms = 60000
interceptor.classes = null
ssl.truststore.password = null
client.id = producer-1
ssl.endpoint.identification.algorithm = null
request.timeout.ms = 30000
acks = all
receive.buffer.bytes = 32768
ssl.truststore.type = JKS
retries = 0
ssl.truststore.location = null
ssl.keystore.password = null
send.buffer.bytes = 131072
compression.type = none
metadata.fetch.timeout.ms = 60000
retry.backoff.ms = 100
sasl.kerberos.kinit.cmd = /usr/bin/kinit
buffer.memory = 33554432
timeout.ms = 30000
key.serializer = class org.apache.kafka.common.serialization.IntegerSerializer
sasl.kerberos.service.name = null
sasl.kerberos.ticket.renew.jitter = 0.05
ssl.trustmanager.algorithm = PKIX
block.on.buffer.full = false
ssl.key.password = null
sasl.kerberos.min.time.before.relogin = 60000
connections.max.idle.ms = 540000
max.in.flight.requests.per.connection = 5
metrics.num.samples = 2
ssl.protocol = TLS
ssl.provider = null
ssl.enabled.protocols = [TLSv1.2, TLSv1.1, TLSv1]
batch.size = 16384
ssl.keystore.location = null
ssl.cipher.suites = null
security.protocol = PLAINTEXT
max.request.size = 1048576
value.serializer = class org.apache.kafka.common.serialization.StringSerializer
ssl.keymanager.algorithm = SunX509
metrics.sample.window.ms = 30000
partitioner.class = class org.apache.kafka.clients.producer.internals.DefaultPartitioner
linger.ms = 1
使用此配置,我丢失了几乎1/3的消息,并出现以下错误
7:27:14.053 [kafka-producer-network-thread | producer-1] ERROR com.abc.telemetry.service.KafkaService - Batch containing 39 record(s) expired due to timeout while requesting metadata from brokers for
我打算为我的用例更新linger.ms,batch.size。还有什么我可以微调以启用此摄取管道而不会丢失任何数据吗?
干杯!
答案 0 :(得分:0)
我已经看到有关在Kafka上发送大量数据的多个问题。因此,我想对此进行一次尝试。
Kafka并非用于发送大量有效载荷/消息。您应该将其视为分布式消息总线,它为您提供分布式系统的所有权限。
由于以下原因,Kafka限制了可以发送的邮件的大小
解决方案:
Reference Based Messaging
消息的巨大消息的位置而不是发送
庞大的数据。这将允许您使用的功能
外部数据存储,也减少了卡夫卡的压力
经纪人。chunk
数据并将其内联并re-assemble
发送到接收器。