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