Home > Database > Mysql Tutorial > body text

Kafka0.8.1 常用操作

WBOY
Release: 2016-06-07 16:37:14
Original
1120 people have browsed it

Kafka的版本间差异较大,下面是0.8.1的操作方法 首先cd到kafaka的bin目录下,操作kafka的工具都在这里呢。如果发现找不到,或者名字不对,说明kafka版本不对。 以topic是test为例子 –zookeeper 后的ip改成你们自己的 创建topic ./kafka-topics.sh –topic t

Kafka的版本间差异较大,下面是0.8.1的操作方法

首先cd到kafaka的bin目录下,操作kafka的工具都在这里呢。如果发现找不到,或者名字不对,说明kafka版本不对。

以topic是test为例子
–zookeeper 后的ip改成你们自己的

创建topic
./kafka-topics.sh –topic test –create –partitions 2 –replication-factor 1 –zookeeper 10.234.10.17:2181,10.234.10.20:2181
partitions 为分区数,0.8.1默认就是2
replication-factor:为复制因子,也就是副本数

查看所有topic
./kafka-topics.sh –list –zookeeper 10.234.10.17:2181,10.234.10.20:2181

删除topic
./kafka-topics.sh –topic test –delete –zookeeper 10.234.10.17:2181,10.234.10.20:2181

查看topic明细
./kafka-topics.sh –topic test –describe –zookeeper 10.234.10.17:2181,10.234.10.20:2181

查看不可用分区
./kafka-topics.sh –topic test –describe –unavailable-partitions –zookeeper 10.234.10.17:2181,10.234.10.20:2181
不知道什么原因就会导致部分分区不可用,用这个命令可以查看。

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!