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 ...
随机推荐
- 洛谷—— P1877 [HAOI2012]音量调节
https://www.luogu.org/problem/show?pid=1877#sub 题目描述 一个吉他手准备参加一场演出.他不喜欢在演出时始终使用同一个音量,所以他决定每一首歌之前他都需要 ...
- 有关于OpenGL、OpenGL ES、WebGL的小结
转自原文 有关于OpenGL.OpenGL ES.WebGL的小结 一. OpenGL简介 OpenGL(全写Open Graphics Library)是个定义了一个跨编程语言.跨平台的编程接口 ...
- Android项目执行时报错NoclassDefFoundError
导Android项目时碰到个头疼的NoclassDefFoundError. 项目导入之后是没有报错的.可是执行就报这个错误 java.lang.NoClassDefFoundError: andro ...
- wxWidgets笔记_1_linux环境下wxwidgets的安装与配置
linux下wxwidgets环境的安装与配置 一.建立目标文件夹(自己定义) mkdir /opt/SCOTT 二.安装wxWidgets 1.wxWidgets版本号能够选用wxGTK-2.8.1 ...
- Android 使用Retrofit请求API数据
概览 Retrofit 是一个Square开发的类型安全的REST安卓客户端请求库.这个库为网络认证.API请求以及用OkHttp发送网络请求提供了强大的框架 .理解OkHttp 的工作流程见 这个 ...
- Oracle修改表空间自增长
下面列出详细过程: 1.通过sql plus 命令登录数据库. 在命令行下输入sqlplus “登录用户名/口令 as 登录类型”就可以登录,系统内建的用户名常用的是sys,密码是在安装oracle过 ...
- UVA Building designing
题目总结来说求一段序列,必须正负交替,且绝对值递增 #include <iostream> #include <cstdio> #include <cstring> ...
- cf 828 A. Restaurant Tables
A. Restaurant Tables time limit per test 1 second memory limit per test 256 megabytes input standard ...
- Codefroces 822C Hacker, pack your bags!
C. Hacker, pack your bags! time limit per test 2 seconds memory limit per test 256 megabytes input s ...
- OpenSUSE42.3 leap 开启ssh登陆
一.产看ssh是否安装 OpenSUSE:~ # rpm -qa | grep ssh libssh2-1-1.4.3-18.3.x86_64openssh-askpass-1.2.4.1-12.1. ...