1. Topic Config
-
某些主题可能需与默认值不同的值:
-
Replication Factor,Partition Number;
-
Message Size,Compression Level;
-
Log Cleanup Policy,Min Insync Replica;
-
2. Overriding Topic Config
-
如min.insync.replicas:此配置在broker level的默认为1;
-
如前所述,此配置的典型值是(replication factor - 1);
-
即:复制因子为3时,min.insync.replicas应为2;
-
首先创建名为topic-config,3个分区,复制因子为1的主题;
3. Create Topic
./kafka-topics.sh \
--bootstrap-server 192.168.0.123:9092 \
--topic topic-config-overriding --create \
--partitions 3 --replication-factor 1
4. Describe Config
-
描述主题,以检查是否为此主题有任何配置覆盖:
./kafka-topics.sh \
--bootstrap-server 192.168.0.123:9092 \
--describe --topic topic-config-overriding