Skip to content

Instantly share code, notes, and snippets.

@yangl
Last active August 29, 2019 08:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yangl/37a06eb8dbebe81750a57fb7760c1af5 to your computer and use it in GitHub Desktop.
Save yangl/37a06eb8dbebe81750a57fb7760c1af5 to your computer and use it in GitHub Desktop.
Kafka保证有序且不丢失配置

不开启事务 情况下

Producer

block.on.buffer.full=true
retries=Integer.MAX_VALUE
acks=all
max.in.flight.requests.per.connection=1

Consumer

enable.auto.commit=false
commit offset only after the message are processed

Broker

replication.factor>=3
min.insync.replicas=2
unclean.leader.election.enable=false

开启事务 情况下

Producer

block.on.buffer.full=true
retries=Integer.MAX_VALUE
acks=all
max.in.flight.requests.per.connection=5
enable.idempotence=true
transactional.id=xxxx

Consumer

enable.auto.commit=false
isolation.level=read_committed
commit offset only after the message are processed

Broker

replication.factor>=3
min.insync.replicas=2
unclean.leader.election.enable=false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment