kafka-consumer.properties

# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
# 
#    http://www.apache.org/licenses/LICENSE-2.0
# 
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# see org.apache.kafka.clients.consumer.ConsumerConfig for more details

# list of brokers used for bootstrapping knowledge about the rest of the cluster
# format: host1:port1,host2:port2 ...
#bootstrap.servers=localhost:9092

# consumer group id
#group.id=test-consumer-group

# What to do when there is no initial offset in Kafka or if the current
# offset does not exist any more on the server: latest, earliest, none
#auto.offset.reset=

#zookeeper鏈接服務器地址
zookeeper.connect=192.168.142.145:2181,192.168.142.146:2181,192.168.142.147:2181

# zookeeper的過時時間,默認5000ms,用於檢測消費者是否掛掉
zookeeper.session.timeout.ms=5000

# 當消費者掛掉,其餘消費者要等該指定時間才能檢查到而且觸發從新負載均衡
zookeeper.connection.timeout.ms=10000

# 指定多久消費者更新offset到zookeeper中。注意offset更新時基於time而不是每次得到的消息,一旦在更新zookeeper發生異常並重啓,將可能拿到已拿到過的消息。
zookeeper.sync.time.ms=2000

#指定消費組
group.id=xxx_gl_kafka_group

#當consumer消費必定量的消息以後,將會自動向zookeeper提交offset信息
#注意offset信息並非每消費一次消息就向zk提交一次,而是先在本地保存(內存),並按期提交,默認爲true
auto.commit.enable=true

#自動更新時間。默認60*1000
auto.commit.interval.ms=1000

#當前consumer的標識,能夠設定,也能夠有系統生成,主要用來跟蹤消息消費狀況,便於觀察
consumer.id=xxx

#消費者客戶端編號,用於區分不一樣客戶端,默認客戶端程序自動產生
client.id=xxxx

#最大取多少塊緩存到消費者(默認爲10)
queued.max.message.chunks=50

當有新的consumer加入group時,將會reblance,此後將會有partition的消費端遷移到新的consumer得到某個partition的消費權限,那麼它將會向zk註冊"partition owner registry"節點信息,可是有可能此時舊的consumer尚沒有釋放此節點,此值用於控制,註冊節點的重試次數。
rebalance.max.retries=5

#獲取信息的最大尺寸,broker不會像consumer輸出大於此值的消息chunk,每次fetch將獲得不少條消息,此值爲總大小,提高此值,將會消耗更多的consumer端內存
fetch.min.bytes=6553600

#當消息的尺寸不足時,server阻塞的時間,若是超時,消息將當即發送給consumer
fetch.wait.max.ms=5000
socket.receive.buffer.bytes=655360

#若是zookeeper沒有offset值或者offset值超出範圍,那麼就給個初始的offset。有smallest、largest、anything可選,分別表示給當前最小的offset、當前最大的offset、拋異常。默認largest
auto.offset.reset=smallest
相關文章
相關標籤/搜索
本站公眾號
   歡迎關注本站公眾號,獲取更多信息