一 kafka本地目录结构

[root@hadoop ~]# cd /tmp/kafka-logs1

[root@hadoop kafka-logs1]# find .
.
./.lock
./recovery-point-offset-checkpoint
./log-start-offset-checkpoint
./cleaner-offset-checkpoint
./replication-offset-checkpoint
./meta.properties
./mytest-1
./mytest-1/leader-epoch-checkpoint
./mytest-1/00000000000000000000.log
./mytest-1/00000000000000000000.index
./mytest-1/00000000000000000000.timeindex
./mytest-0
./mytest-0/leader-epoch-checkpoint
./mytest-0/00000000000000000000.log
./mytest-0/00000000000000000000.index
./mytest-0/00000000000000000000.timeindex

 

搭建单节点多broker的kafka后,启动zk和kafka。

[root@hadoop ~]# cd /usr/local/kafka
[root@hadoop kafka]# zookeeper-server-start.sh config/zookeeper.properties 
...
[root@hadoop kafka]# kafka-server-start.sh config/server0.properties &
...
[root@hadoop kafka]# kafka-server-start.sh config/server1.properties &
...
[root@hadoop kafka]# kafka-server-start.sh config/server2.properties &
...

[root@hadoop ~]# jps
4133 QuorumPeerMain
4791 Kafka
5452 Kafka
5780 Kafka
6164 Jps

创建kafka集群时我已经创建了一个主题test02,现在我们再创建一个主题mytest(2个分区)

[root@hadoop ~]# cd /usr/local/kafka
[root@hadoop kafka]# kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 3 --partitions 2 --topic mytest
Created topic "mytest".

查看日志目录可以发现,3个日志目录几乎是一致的(__consumer_offsets-0是个什么鬼?)

test02和mytest副本数均是3,所以3个broker的log下面均有;
test02只有一个分区,mytest有2个分区,所以有一个test02目录,和2个mytest目录。

[root@hadoop ~]# ll /tmp/kafka-logs0
总用量 16
-rw-r--r-- 1 root root    0 8月   3 11:02 cleaner-offset-checkpoint
drwxr-xr-x 2 root root  141 8月   3 11:02 __consumer_offsets-0
-rw-r--r-- 1 root root    4 8月   5 00:44 log-start-offset-checkpoint
-rw-r--r-- 1 root root   54 8月   3 11:02 meta.properties
drwxr-xr-x 2 root root  141 8月   5 00:31 mytest-0 #命名格式:主题-分区
drwxr-xr-x 2 root root  141 8月   5 00:31 mytest-1
-rw-r--r-- 1 root root 1241 8月   5 00:44 recovery-point-offset-checkpoint
-rw-r--r-- 1 root root 1241 8月   5 00:44 replication-offset-checkpoint
drwxr-xr-x 2 root root  178 8月   3 11:49 test02-0

[root@hadoop ~]# ll /tmp/kafka-logs1
总用量 16
-rw-r--r-- 1 root root   0 7月  31 16:05 cleaner-offset-checkpoint
-rw-r--r-- 1 root root   4 8月   5 00:48 log-start-offset-checkpoint
-rw-r--r-- 1 root root  54 7月  31 16:05 meta.properties
drwxr-xr-x 2 root root 141 8月   5 00:31 mytest-0
drwxr-xr-x 2 root root 141 8月   5 00:31 mytest-1
-rw-r--r-- 1 root root  85 8月   5 00:48 recovery-point-offset-checkpoint
-rw-r--r-- 1 root root  85 8月   5 00:49 replication-offset-checkpoint
drwxr-xr-x 2 root root 178 8月   4 23:29 test02-0

[root@hadoop ~]# ll /tmp/kafka-logs2
总用量 16
-rw-r--r-- 1 root root   0 7月  31 16:06 cleaner-offset-checkpoint
-rw-r--r-- 1 root root   4 8月   5 00:48 log-start-offset-checkpoint
-rw-r--r-- 1 root root  54 7月  31 16:06 meta.properties
drwxr-xr-x 2 root root 141 8月   5 00:31 mytest-0
drwxr-xr-x 2 root root 141 8月   5 00:31 mytest-1
-rw-r--r-- 1 root root  85 8月   5 00:48 recovery-point-offset-checkpoint
-rw-r--r-- 1 root root  85 8月   5 00:49 replication-offset-checkpoint
drwxr-xr-x 2 root root 178 8月   4 23:29 test02-0
View Code

相关文章:

  • 2021-07-11
  • 2021-09-11
  • 2021-10-05
  • 2021-10-31
  • 2021-12-20
  • 2022-12-23
  • 2022-01-12
猜你喜欢
  • 2021-06-04
  • 2022-01-27
  • 2022-12-23
  • 2021-12-07
  • 2021-05-19
  • 2022-12-23
  • 2021-11-21
相关资源
相似解决方案