kafka 重启的一些记录

重启前集群的一些状态记录:

 

[els@els1 wchane-1]$ kafka-topics.sh --zookeeper 10.156.10.126:2181 --describe --topic wchane

Topic:wchane PartitionCount:3 ReplicationFactor:2 Configs:

Topic: wchane Partition: 0 Leader: 2 Replicas: 2,0 Isr: 2,0

Topic: wchane Partition: 1 Leader: 0 Replicas: 0,1 Isr: 0,1

Topic: wchane Partition: 2 Leader: 1 Replicas: 1,2 Isr: 1,2

 

 

查看 brokerid 为 0 下文件的更新时间:

 

[els@els1 wchane-1]$ ls -al

总用量 20496

drwxrwxr-x 2 els els 4096 5月 28 10:28 .

drwxrwxr-x 5 els els 4096 5月 28 10:37 ..

-rw-rw-r-- 1 els els 10485760 5月 28 10:28 00000000000000000000.index

-rw-rw-r-- 1 els els 95 5月 28 10:28 00000000000000000000.log

-rw-rw-r-- 1 els els 10485756 5月 28 10:28 00000000000000000000.timeindex

-rw-rw-r-- 1 els els 8 5月 28 10:28 leader-epoch-checkpoint

 

接下来把brokerid 为0 的节点杀了

kill ****

接下来我们看看集群的一些状态:

Topic:wchane PartitionCount:3 ReplicationFactor:2 Configs:

Topic: wchane Partition: 0 Leader: 2 Replicas: 2,0 Isr: 2

Topic: wchane Partition: 1 Leader: 1 Replicas: 0,1 Isr: 1

Topic: wchane Partition: 2 Leader: 1 Replicas: 1,2 Isr: 1,2

 

接下来我们重启一下。

nohup kafka-server-start.sh ../config/server.properties &

 

接下来我们再看看集群的一些状态:

[els@els1 wchane-1]$ kafka-topics.sh --zookeeper 10.156.10.126:2181 --describe --topic wchane

Topic:wchane PartitionCount:3 ReplicationFactor:2 Configs:

Topic: wchane Partition: 0 Leader: 2 Replicas: 2,0 Isr: 2,0

Topic: wchane Partition: 1 Leader: 0 Replicas: 0,1 Isr: 1,0

Topic: wchane Partition: 2 Leader: 1 Replicas: 1,2 Isr: 1,2

 

发现brokerid=0的重新加入了集群并且恢复为leader。

 

再来看看日志文件的一些变化

[els@els1 wchane-1]$ ls -al

总用量 20500

drwxrwxr-x 2 els els 4096 5月 28 10:39 .

drwxrwxr-x 5 els els 4096 5月 28 10:48 ..

-rw-rw-r-- 1 els els 10485760 5月 28 10:42 00000000000000000000.index

-rw-rw-r-- 1 els els 95 5月 28 10:28 00000000000000000000.log

-rw-rw-r-- 1 els els 10485756 5月 28 10:42 00000000000000000000.timeindex

-rw-rw-r-- 1 els els 10 5月 28 10:39 00000000000000000002.snapshot

-rw-rw-r-- 1 els els 8 5月 28 10:28 leader-epoch-checkpoint

 

接下来。试试强杀

kill -9 **

[els@els1 wchane-1]$ kafka-topics.sh --zookeeper 10.156.10.126:2181 --describe --topic wchane

Topic:wchane PartitionCount:3 ReplicationFactor:2 Configs:

Topic: wchane Partition: 0 Leader: 2 Replicas: 2,0 Isr: 2

Topic: wchane Partition: 1 Leader: 1 Replicas: 0,1 Isr: 1

Topic: wchane Partition: 2 Leader: 1 Replicas: 1,2 Isr: 1,2

 

 

重启之后:

[els@els1 wchane-1]$ kafka-topics.sh --zookeeper 10.156.10.126:2181 --describe --topic wchane

Topic:wchane PartitionCount:3 ReplicationFactor:2 Configs:

Topic: wchane Partition: 0 Leader: 2 Replicas: 2,0 Isr: 2,0

Topic: wchane Partition: 1 Leader: 1 Replicas: 0,1 Isr: 1,0

Topic: wchane Partition: 2 Leader: 1 Replicas: 1,2 Isr: 1,2

 

 

总用量 20500

drwxrwxr-x 2 els els 4096 5月 28 10:51 .

drwxrwxr-x 5 els els 4096 5月 28 10:52 ..

-rw-rw-r-- 1 els els 10485760 5月 28 10:51 00000000000000000000.index

-rw-rw-r-- 1 els els 95 5月 28 10:28 00000000000000000000.log

-rw-rw-r-- 1 els els 10485756 5月 28 10:51 00000000000000000000.timeindex

-rw-rw-r-- 1 els els 10 5月 28 10:51 00000000000000000002.snapshot

-rw-rw-r-- 1 els els 8 5月 28 10:28 leader-epoch-checkpoint

 

接下来。停了broker 0 并进行数据写入。

 

[els@els1 wchane-1]$ kafka-topics.sh --zookeeper 10.156.10.126:2181 --describe --topic wchane

Topic:wchane PartitionCount:3 ReplicationFactor:2 Configs:

Topic: wchane Partition: 0 Leader: 2 Replicas: 2,0 Isr: 2

Topic: wchane Partition: 1 Leader: 1 Replicas: 0,1 Isr: 1

Topic: wchane Partition: 2 Leader: 2 Replicas: 1,2 Isr: 2,1

 

写入数据之后再试试重启

[els@els1 wchane-1]$ kafka-topics.sh --zookeeper 10.156.10.126:2181 --describe --topic wchane

Topic:wchane PartitionCount:3 ReplicationFactor:2 Configs:

Topic: wchane Partition: 0 Leader: 2 Replicas: 2,0 Isr: 2,0

Topic: wchane Partition: 1 Leader: 1 Replicas: 0,1 Isr: 1,0

Topic: wchane Partition: 2 Leader: 1 Replicas: 1,2 Isr: 2,1

 

 

[els@els1 wchane-1]$ ls -al

总用量 20500

drwxrwxr-x 2 els els 4096 5月 28 11:02 .

drwxrwxr-x 5 els els 4096 5月 28 11:03 ..

-rw-rw-r-- 1 els els 10485760 5月 28 11:02 00000000000000000000.index

-rw-rw-r-- 1 els els 190 5月 28 11:02 00000000000000000000.log

-rw-rw-r-- 1 els els 10485756 5月 28 11:02 00000000000000000000.timeindex

-rw-rw-r-- 1 els els 10 5月 28 10:51 00000000000000000002.snapshot

-rw-rw-r-- 1 els els 12 5月 28 11:02 leader-epoch-checkpoint

发现日志文件也进行的更新。

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值