0,
This value controls when a produce request is considered completed. Specifically, how many other brokers must have committed the data to their log and acknowledged this to the leader? Typical values are
0 , which means that the producer never waits for an acknowledgement from the broker (the same behavior as 0.7). This option provides the lowest latency but the weakest durability guarantees (some data will be lost when a server fails).
【0:producer push出消息之后,永遠(yuǎn)不會等待broker的ack】
1,
which means that the producer gets an acknowledgement after the leader replica has received the data. This option provides better durability as the client waits until the server acknowledges the request as successful (only messages that were written to the now-dead leader but not yet replicated will be lost).
【leader replica收到數(shù)據(jù)后辐宾,producer會得到一個ack傀履;提供了更好的持久性,因為clienet能等到server收到ack羞延;如果消息剛剛寫到leader上,還沒來得及復(fù)制leader就掛啦,那么消息就會丟失了卖丸】访酰】
-1,
which means that the producer gets an acknowledgement after all in-sync replicas have received the data. This option provides the best durability, we guarantee that no messages will be lost as long as at least one in sync replica remains.
【所有在列的ISR in-sync-replica 都收到數(shù)據(jù)后才給producer一個ack】