1.3 Quick Start中 Step 3: Create a topic官网剖析(博主推荐)
不多说,直接上干货!
一切来源于官网
http://kafka.apache.org/documentation/
Step 3: Create a topic
Let's create a topic named "test" with a single partition and only one replica:
> bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test
We can now see that topic if we run the list topic command:
创建好之后,可以通过运行以下命令,查看已创建的topic信息:
> bin/kafka-topics.sh --list --zookeeper localhost:2181
test
Alternatively, instead of manually creating topics you can also configure your brokers to auto-create topics when a non-existent topic is published to.
其实,这个很简单,比如--create就是创建,--list是查看。当然,不能局限于官网,大家要灵活多变,官网只是个参考和引子。
--topic test 名字为test的topic
--partitions 1 分区数为1
--replication-factor 1 复制因子是1(即每个分区在集群中有1份数据)
--zookeeper localhost:2181 这个不多说,太简单
比如,我们一般写
bin/kafka-topics.sh --create --zookeeper master: --replication-factor --partitions --topic t-behavior
或
bin/kafka-topics.sh --create --zookeeper hadoop1: --replication-factor --partitions --topic t-behavior
说明: --replication-factor 3 指定了复制因子3,即每个分区在集群中有3份数据 --partitions 10 指定topic的分区数10
--topic t-behavior 指定创建名为t-behavior的topic
同时,查看topic详情
bin/kafka-topics.sh --zookeeper txy001: --topic t-behavior --describe
打印如下:
Topic:t-behavior PartitionCount: ReplicationFactor: Configs:
Topic: t-behavior Partition: Leader: Replicas: ,, Isr: ,,
Topic: t-behavior Partition: Leader: Replicas: ,, Isr: ,,
Topic: t-behavior Partition: Leader: Replicas: ,, Isr: ,,
Topic: t-behavior Partition: Leader: Replicas: ,, Isr: ,,
Topic: t-behavior Partition: Leader: Replicas: ,, Isr: ,,
Topic: t-behavior Partition: Leader: Replicas: ,, Isr: ,,
Topic: t-behavior Partition: Leader: Replicas: ,, Isr: ,,
Topic: t-behavior Partition: Leader: Replicas: ,, Isr: ,,
Topic: t-behavior Partition: Leader: Replicas: ,, Isr: ,,
Topic: t-behavior Partition: Leader: Replicas: ,, Isr: ,,
说明;
ReplicationFactor 表示复制因子,即每个分区有几份数据
Leader 分区的主在那个broker上
Replicas 表示分区数据分布在哪些broker上
Isr 表示可立即作为分区的主的broker,即标识3分数据已经保持一致了。
over
1.3 Quick Start中 Step 3: Create a topic官网剖析(博主推荐)的更多相关文章
- 1.3 Quick Start中 Step 4: Send some messages官网剖析(博主推荐)
不多说,直接上干货! 一切来源于官网 http://kafka.apache.org/documentation/ Step 4: Send some messages Step : 发送消息 Kaf ...
- 1.3 Quick Start中 Step 2: Start the server官网剖析(博主推荐)
不多说,直接上干货! 一切来源于官网 http://kafka.apache.org/documentation/ Step 2: Start the server Step : 启动服务 Kafka ...
- 1.3 Quick Start中 Step 5: Start a consumer官网剖析(博主推荐)
不多说,直接上干货! 一切来源于官网 http://kafka.apache.org/documentation/ Step 5: Start a consumer Step : 消费消息 Kafka ...
- 1.3 Quick Start中 Step 1: Download the code官网剖析(博主推荐)
不多说,直接上干货! 一切来源于官网 http://kafka.apache.org/documentation/ 不要局限于,这个版本,我只是以最新的版本,来做个引子,让大家对官网的各个kafka版 ...
- 1.1 Introduction中 Kafka as a Storage System官网剖析(博主推荐)
不多说,直接上干货! 一切来源于官网 http://kafka.apache.org/documentation/ Kafka as a Storage System kafka作为一个存储系统 An ...
- 1.1 Introduction中 Kafka as a Messaging System官网剖析(博主推荐)
不多说,直接上干货! 一切来源于官网 http://kafka.apache.org/documentation/ Kafka as a Messaging System kafka作为一个消息系统 ...
- 1.3 Quick Start中 Step 8: Use Kafka Streams to process data官网剖析(博主推荐)
不多说,直接上干货! 一切来源于官网 http://kafka.apache.org/documentation/ Step 8: Use Kafka Streams to process data ...
- 1.3 Quick Start中 Step 7: Use Kafka Connect to import/export data官网剖析(博主推荐)
不多说,直接上干货! 一切来源于官网 http://kafka.apache.org/documentation/ Step 7: Use Kafka Connect to import/export ...
- 1.3 Quick Start中 Step 6: Setting up a multi-broker cluster官网剖析(博主推荐)
不多说,直接上干货! 一切来源于官网 http://kafka.apache.org/documentation/ Step 6: Setting up a multi-broker cluster ...
随机推荐
- Unity 之 C# 利用回调函数实现C++匿名函数
做C++开发的都用过匿名函数很好用,可是C#开发怎么实现呢?前几天做一个拍照功能的时候.我偶然发现某个函数假设是C++的话.用匿名函数太好了,于是開始研究C#的回调,代理.托付等,最后总算是实现了我想 ...
- 算法导论————EXKMP
[例题传送门:caioj1461] [EXKMP]最长共同前缀长度 [题意]给出模板串A和子串B,长度分别为lenA和lenB,要求在线性时间内,对于每个A[i](1<=i<=lenA), ...
- thinkphp里面使用原生php
thinkphp里面使用原生php Php代码可以和标签在模板文件中混合使用,可以在模板文件里面书写任意的PHP语句代码 ,包括下面两种方式: 使用php标签 例如: {php}echo 'Hello ...
- 20.发送http请求服务 ($http)
转自:https://www.cnblogs.com/best/tag/Angular/ 服务从代码直接与服务器进行交互,底层是通过实现,与中http服务从AngularJS代码直接与Web服务器进行 ...
- 特性Attibute定义和使用
1.定义特性 [AttributeUsage(AttributeTargets.Class,AllowMultiple = false,Inherited = false)] public class ...
- 记录一下 mysql 的查询中like字段的用法
SELECT * from t_yymp_auth_role where role_name not like '%测试%' and role_name not like '%部门%' and rol ...
- MHP 宿舍摄像头在门卫显示方案
通过VPN拨入公司内网,实现访问外网摄像头. 1. 宿舍和MHP公司各增加一条上网线路(可用移动) 2.宿舍处理: 2台带TF卡 摄像头,加入到萤石云端 130万摄像头+64G TF卡 3.宿 ...
- JS之预编译和执行顺序(全局和函数)
预编译的两种情况 全局: 1.全局 直接是script标签中的代码,不包括函数执行 执行前: 1.首先生成一个GO(global object)对象,看不到,但是可以模拟出来用来分析 2.分析变量声明 ...
- python数据处理技巧二
python数据处理技巧二(掌控时间) 首先简单说下关于时间的介绍其中重点是时间戳的处理,时间戳是指格林威治时间1970年01月01日00时00分00秒(北京时间1970年01月01日08时00分00 ...
- Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-qvc66dfs/supervisor/
# 安装supervisor 出错 pip3 install supervisor # 解决 sudo pip3 install supervisor