0

使用 npm librdkafka 我正在向 Kafka 生成大量数据。我正在使用 HighlevelProducer。对于 50K 消息,此配置工作正常。但是对于像 100K 消息这样的大容量,会有数据丢失。根据配置,数据丢失从 200-1K 不等。尝试了各种配置,但无法找到达到 100% 准确度的最佳配置。任何建议都是有帮助的。下面是我的配置。

var producerConfigOptions = {
            'request.required.acks': requireAcknowledge,
            'client.id': producerClientId,
            'compression.codec': 'gzip',
            'metadata.broker.list': msgSystemConnectionString,
            'security.protocol': 'ssl',
            'ssl.key.location': clintCertKeyFile,
            'ssl.certificate.location': clientCertFile,
            'ssl.ca.location': caFile,
            'retry.backoff.ms': 200,
            'message.send.max.retries': 10,
            'socket.keepalive.enable': true,
            'queue.buffering.max.messages': 50000,
            'queue.buffering.max.ms': 100,
            'batch.num.messages': 50000,
            'dr_cb': true,
            }

       var ProducerInstance= new Kafka.HighLevelProducer(producerConfigOptions);
        ProducerInstance.connect({}, (err) => {
        if(err)
        {
        console.log(error)
        }
        else
        {
        
            ProducerInstance.produce(topicName, lastUsedPartition, Buffer.from(msg), msgKey, Date.now(), (err, offset) => {
    //logic to store offset
        }
        
        }
        }
4

0 回答 0