Kafka Study : Understand the Partitions and replicates
来源:互联网 发布:网络舆情监测方法 编辑:程序博客网 时间:2024/06/04 23:15
test configurations:
- start zookeeper at port 2181
- start kafka instance 0 at port 9092 (using default server.properties).
- kafka_folder] bin/kafka-server-start.sh
- start kafka instance 1
- create new server1.properteis, change the id=1, port=9093 and log directory;
- bin/kafka-server-start.sh config/server1.properties
- start kafka instance 2
- create new server2.properteis, change the id=2, port=9094 and log directory;
- bin/kafka-server-start.sh config/server2.properties
- create topic: kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 2 --partitions 3 --topic my-replicated-test-topic
- check the topic partion and replicates:
kafka-topics.sh --describe --topic my-replicated-test-topic --zookeeper localhost:2181
- Topic:my-replicated-test-topic PartitionCount:3 ReplicationFactor:2 Configs:
- Topic: my-replicated-test-topic Partition: 0 Leader: 0 Replicas: 0,1 Isr: 0,1
- Topic: my-replicated-test-topic Partition: 1 Leader: 1 Replicas: 1,2 Isr: 1,2
- Topic: my-replicated-test-topic Partition: 2 Leader: 2 Replicas: 2,0 Isr: 2,0
- publish message through different kafka instance:
- kafka-console-producer.sh --broker-list localhost:9092 --topic my-replicated-test-topic
- 1st message
- 2nd message
- 3rd message
- kafka-console-producer.sh --broker-list localhost:9093 --topic my-replicated-test-topic
- 4th message
- 5th message
- 6th message
- kafka-console-producer.sh --broker-list localhost:9094 --topic my-replicated-test-topic
- 7th message
- 8th message
- 9th message
- check the storage: kafka instance 0kafka instance 1kafka instance 2my-replicated-test-topic-replicate-0:
2nd message, 6th message, 8th messagemy-replicated-test-topic-replicate-0:
2nd message, 6th message, 8th message my-replicated-test-topic-replicate-1:
1st message, 5th message, 7th messagemy-replicated-test-topic-replicate-1:
1st message, 5th message, 7th messagemy-replicated-test-topic-replicate-2:
3rd message, 4th message, 9th message my-replicated-test-topic-replicate-2:
3rd message, 4th message, 9th message - consumer from beginning from any broker:
- kafka-console-consumer.sh --zookeeper localhost:2181 --topic my-replicated-test-topic --from-beginning
- 1st message
- 2nd message
- 5th message
- 7th message
- 6th message
- 8th message
- 3rd message
- 4th message
- 9th message
- we can see that: the order from one partition was assured, but from different partitions is not assured
0 0
- Kafka Study : Understand the Partitions and replicates
- Apache Kafka笔记(二):Topics,Partitions and Brokers
- the understand of SOA and Web Services
- How to choose the number of topics/partitions in a Kafka cluster?
- How to choose the number oftopics/partitions in a Kafka cluster?
- Understand the difference between IN and EXISTS in subqueries
- Understand on the tf.variable_scope and tf.name_scope
- Effective STL 19 understand the difference between equality and equivalence
- Kafka kafka-reassign-partitions.sh 命令使用
- Test and study the pose optimisation module
- Kafka集群partitions/replicas默认分配解析
- kafka增加topic 的partitions数量
- Kafka分区分配计算(分区器Partitions)
- Understand the serialVersionUID
- Understand the serialVersionUID
- Understand The SerialVersionUID
- Understand The SerialVersionUID
- Understand the Business Domain
- 运行ant的javac命令时报错:Unsupported major.minor version 51.0 时抛出异常的解决办法
- 下载代码的网站+iOS常用网站
- 算法-树的相关算法
- 数据字典与元数据
- ubuntu的su初始密码设置
- Kafka Study : Understand the Partitions and replicates
- 各种测试
- opengl渲染管线简述
- html学习笔记
- Sublime Text 3 3114注册激活码
- 数据结构---排序
- DOM4J入门
- 微信随笔
- CNN——架构上的一些数字