1
2
3
4
5
6
7
8
9
10
11
12
13
[hadoop@hadoop01 bin]$ kafka-topics.sh --create --zookeeper hadoop01,hadoop02,hadoop03 --replication-factor 1 --partitions 3 --topic hadoop01
Created topic "hadoop01".
[hadoop@hadoop01 bin]$ kafka-topics.sh --create --zookeeper hadoop01,hadoop02,hadoop03 --replication-factor 3 --partitions 1 --topic hadoop02
Created topic "hadoop02".
[hadoop@hadoop01 bin]$ kafka-topics.sh --list --zookeeper localhost:2181
hadoop01
hadoop02
[hadoop@hadoop01 bin]$ kafka-topics.sh --describe --zookeeper localhost:2181 --topic hadoop01
Topic:hadoop01 PartitionCount:3 ReplicationFactor:1 Configs:
Topic: hadoop01 Partition: 0 Leader: 3 Replicas: 3 Isr: 3
Topic: hadoop01 Partition: 1 Leader: 1 Replicas: 1 Isr: 1
Topic: hadoop01 Partition: 2 Leader: 2 Replicas: 2 Isr: 2
----------------------------------

检查log目录,对于topic hadoop01,hadoop01为0号分区,hadoop02为1号分区。
而topic hadoop02则复制了3份,都为0号分区
hadoop01-1
hadoop02-0
hadoop01-2
hadoop02-0
hadoop01-0
hadoop02-0
即:hadoop01-0,1,2
hadoop02-0,0,0
C82B7620E6144C87BCEBB62E62FE14B8.jpg-59kB
6A3AAA2431D14E198FA0BBD5DDCCB911.jpg-49.7kB
34C69FFC6FBF48D18F2F58D5A8E9954F.jpg-58.7kB