Kafka集群部署与配置手册(2)

############################# Replication configurations ################
# default replication factors for automatically created topics
default.replication.factor=3
# Number of fetcher threads used to replicate messages from a source broker.
num.replica.fetchers=4
# The number of bytes of messages to attempt to fetch for each partition.
replica.fetch.max.bytes=1048576
# max wait time for each fetcher request issued by follower replicas.
replica.fetch.wait.max.ms=500
# The frequency with which the high watermark is saved out to disk
replica.high.watermark.checkpoint.interval.ms=5000
# The socket timeout for network requests.
replica.socket.timeout.ms=30000
# The socket receive buffer for network requests
replica.socket.receive.buffer.bytes=65536
# If a follower hasn't sent any fetch requests or hasn't consumed up to the leaders log end offset for at least this time, the leader will remove the follower from isr
replica.lag.time.max.ms=10000
# The socket timeout for controller-to-broker channels
controller.socket.timeout.ms=30000
controller.message.queue.size=10


7、配置kafka生产者和消费者
修改/data/kafka/config下的producer.properties文件
bootstrap.servers=192.168.10.1:9092,192.168.10.2:9092,192.168.10.3:9092
producer.type=async
compression.type=snappy
 
修改/data/kafka/config下的comsumer.properties文件
zookeeper.connect=192.168.10.1:2181,192.168.10.2:2181,192.168.10.3:2181
 
8、kafka集群服务启停管理的配置
 
#exec $base_dir/kafka-run-class.sh $EXTRA_ARGS kafka.Kafka "$@" 
exec $base_dir/kafka-run-class.sh $EXTRA_ARGS kafka.Kafka "../config/server.properties" 

chmod +x bin/kafka-server-start.sh kafka-server-stop.sh

修改kafka-server-start.sh

more kafka-server-start.sh
#!/bin/bash
#if [ $# -lt 1 ];
#then
#    echo "USAGE: $0 [-daemon] server.properties [--override property=value]*"
#    exit 1
#fi
base_dir=$(dirname $0)

if [ "x$KAFKA_LOG4J_OPTS" = "x" ]; then
    export KAFKA_LOG4J_OPTS="-Dlog4j.configuration=file:$base_dir/../config/log4j.properties"
fi

if [ "x$KAFKA_HEAP_OPTS" = "x" ]; then
    export KAFKA_HEAP_OPTS="-Xmx5G -Xms5G"
fi

EXTRA_ARGS="-name kafkaServer -loggc"

#COMMAND=$1
COMMAND="-daemon"
case $COMMAND in
  -daemon)
    EXTRA_ARGS="-daemon "$EXTRA_ARGS
    shift
    ;;
  *)
    ;;
esac

#exec $base_dir/kafka-run-class.sh $EXTRA_ARGS kafka.Kafka "$@"
exec $base_dir/kafka-run-class.sh $EXTRA_ARGS kafka.Kafka "../config/server.properties"

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/7853397c2e5bf77c9414c0e80ec610f3.html