kafka-linux-install
linux按照kafka
必须先按照java jdk包!!!!!!!!!!!!
先安装zookeeper
下载:http://mirrors.hust.edu.cn/apache/zookeeper/zookeeper-3.4.14/zookeeper-3.4.14.tar.gz
解压,整个目录复制到/usr/local中
环境变量配置
编辑环境变量配置文件:vim /etc/profile
在文件末尾位置添加如下内容
export ZOOKEEPER_HOME=/usr/local/zookeeper-3.4.11
export PATH=$PATH:$ZOOKEEPER_HOME/bin
通过vim的 ":wq"
命令进行保存退出
使配置生效:source /etc/profile
修改zookeeper的配置文件
进入conf文件夹下将zoo_simple.cfg改名为zoo.cfg:mv zoo_sample.cfg zoo.cfg
zkServer.sh start|stop|restart|status
客户端连接:
zkCli.sh -server ${ip}:${port}
客户端关闭:
quit
或者按 Ctrl + C
启动即可

bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic demo
[root@better.qzqlsj.club kafka_2.13-2.5.0]$bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic huolala-kafka-topic
OpenJDK 64-Bit Server VM warning: If the number of processors is expected to increase from one, then you should configure the number of parallel GC threads appropriately using -XX:ParallelGCThreads=N
Created topic huolala-kafka-topic.
解析:
partitions指定topic分区数
replication-factor指定topic每个分区的副本数
--zookeeper:表示在这个集群里面创建
查询toipc列表
bin/kafka-topics.sh --zookeeper localhost:2181 --list
bin/kafka-topics.sh --zookeeper 129.204.3.133:2181 --list
[root@better.qzqlsj.club kafka_2.13-2.5.0]$bin/kafka-topics.sh --zookeeper localhost:2181 --list
OpenJDK 64-Bit Server VM warning: If the number of processors is expected to increase from one, then you should configure the number of parallel GC threads appropriately using -XX:ParallelGCThreads=N
__consumer_offsets
demo
huolala
huolala-kafka-topic
my-kafka-topic
test
查看指定topic信息
bin/kafka-topics.sh --zookeeper 129.204.3.133:2181 --describe --topic huolala
[root@better.qzqlsj.club kafka_2.13-2.5.0]$bin/kafka-topics.sh --zookeeper 129.204.3.133:2181 --describe --topic huolala
OpenJDK 64-Bit Server VM warning: If the number of processors is expected to increase from one, then you should configure the number of parallel GC threads appropriately using -XX:ParallelGCThreads=N
Topic: huolala PartitionCount: 1 ReplicationFactor: 1 Configs:
Topic: huolala Partition: 0 Leader: 0 Replicas: 0 Isr: 0
删除topic
bin/kafka-topics.sh --zookeeper localhost:2181 --delete --topic my-kafka-topic
[root@better.qzqlsj.club kafka_2.13-2.5.0]$bin/kafka-topics.sh --zookeeper localhost:2181 --delete --topic my-kafka-topic
OpenJDK 64-Bit Server VM warning: If the number of processors is expected to increase from one, then you should configure the number of parallel GC threads appropriately using -XX:ParallelGCThreads=N
Topic my-kafka-topic is marked for deletion.
Note: This will have no impact if delete.topic.enable is not set to true.
[root@better.qzqlsj.club kafka_2.13-2.5.0]$bin/kafka-topics.sh --zookeeper 129.204.3.133:2181 --list
OpenJDK 64-Bit Server VM warning: If the number of processors is expected to increase from one, then you should configure the number of parallel GC threads appropriately using -XX:ParallelGCThreads=N
__consumer_offsets
demo
huolala
huolala-kafka-topic
test
[root@better.qzqlsj.club kafka_2.13-2.5.0]$
kafka 生产和消费:
bin/kafka-console-producer.sh --broker-list localhost:9092 --topic huolala
代理列表 - 我们要发送邮件的代理列表。 在这种情况下,我们只有一个代理。 Config / server.properties文件包含代理端口ID,因为我们知道我们的代理正在侦听端口9092
直接指定它。主题huolala
启动消费者
bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic huolala --from-beginning
查看topic某分区偏移量最大(小)值
bin/kafka-run-class.sh kafka.tools.GetOffsetShell --topic huolala --time -1 --broker-list localhost:9092 --partitions 0
[root@better.qzqlsj.club kafka_2.13-2.5.0]$bin/kafka-run-class.sh kafka.tools.GetOffsetShell --topic huolala --time -1 --broker-list localhost:9092 --partitions 0
OpenJDK 64-Bit Server VM warning: If the number of processors is expected to increase from one, then you should configure the number of parallel GC threads appropriately using -XX:ParallelGCThreads=N
huolala:0:16
增加topic分区数
bin/kafka-topics.sh --zookeeper localhost:2181 --alter --topic huolala --partitions 10
[root@better.qzqlsj.club kafka_2.13-2.5.0]$bin/kafka-topics.sh --zookeeper localhost:2181 --alter --topic huolala --partitions 10
OpenJDK 64-Bit Server VM warning: If the number of processors is expected to increase from one, then you should configure the number of parallel GC threads appropriately using -XX:ParallelGCThreads=N
WARNING: If partitions are increased for a topic that has a key, the partition logic or ordering of the messages will be affected
Adding partitions succeeded!
[root@better.qzqlsj.club kafka_2.13-2.5.0]$bin/kafka-topics.sh --zookeeper 129.204.3.133:2181 --describe --topic huolala
OpenJDK 64-Bit Server VM warning: If the number of processors is expected to increase from one, then you should configure the number of parallel GC threads appropriately using -XX:ParallelGCThreads=N
Topic: huolala PartitionCount: 10 ReplicationFactor: 1 Configs:
Topic: huolala Partition: 0 Leader: 0 Replicas: 0 Isr: 0
Topic: huolala Partition: 1 Leader: 0 Replicas: 0 Isr: 0
Topic: huolala Partition: 2 Leader: 0 Replicas: 0 Isr: 0
Topic: huolala Partition: 3 Leader: 0 Replicas: 0 Isr: 0
Topic: huolala Partition: 4 Leader: 0 Replicas: 0 Isr: 0
Topic: huolala Partition: 5 Leader: 0 Replicas: 0 Isr: 0
Topic: huolala Partition: 6 Leader: 0 Replicas: 0 Isr: 0
Topic: huolala Partition: 7 Leader: 0 Replicas: 0 Isr: 0
Topic: huolala Partition: 8 Leader: 0 Replicas: 0 Isr: 0
Topic: huolala Partition: 9 Leader: 0 Replicas: 0 Isr: 0
kafka-linux-install的更多相关文章
- linux install wineQQ
Linux上没有QQ太麻烦了,查了一下讲wineQQ安装上去了,亲测可以使用滴---就是版本低,安装步骤如下: 一.安装Wine 1.添加PPA sudo add-apt-repository ppa ...
- linux install Theano+Tensorflow+Keras
安装过程中,网络状态一定要好,如果安装过程中出现time out的提示信息,今天就可以洗洗睡啦,等明天网络状态好的时候再安装. 安装过程出现不知名的错误的时候,执行第一步,update一下 1.#up ...
- linux install sublime_text3
ubuntu & debian: (baidu or google) 1). download ***.deb to install inux系统下怎么安装.deb文件? deb 是 ubun ...
- Linux install sogou input method
# Copyright (c) 2016, 付刘伟 (Liuwei Fu)# All rights reserved.# 转载请注明出处 Linux下安装搜狗输入法需要安装以下插件,当以下所有插件安装 ...
- Kafka~Linux环境下的部署
概念 Kafka是一种高吞吐量的分布式发布订阅消息系统,它可以处理消费者规模的网站中的所有动作流数据. 这种动作(网页浏览,搜索和其他用户的行动)是在现代网络上的许多社会功能的一个关键因素. 这些数据 ...
- linux install tomcat
折腾了好久,按照官网的安装流程安装了不止3次,发现还是不能成功,最终发现是linux机器本身的问题,因为我用的公司的virtual machine,可能是机器本身在一次迁移的过程当中出现了问题,导致了 ...
- 2018 kali linux install tools
1.VM setup https://www.vmware.com/products/workstation-pro/workstation-pro-evaluation.html VMware-Wo ...
- RHEL / CentOS Linux Install Core Development Tools Automake, Gcc (C/C++), Perl, Python & Debuggers
how do I install all developer tools such as GNU GCC C/C++ compilers, make and others, after install ...
- linux install mysql
sudo apt-get install mysql-server #此处会输入root的密码,设置的密码要记住 sudo apt-get install mysql-client sudo apt- ...
- Kafka Linux 安装
要先设置host, etc/hosts,添加 127.0.0.1 机器名 创建目录 修改日志保存位置 ...
随机推荐
- PRML 回归的线性模型
线性模型最简单的形式就是输入变量的线性模型,但是,将一组输入变量的非线性函数进行线性组合,我们可以得到一类更加有用的函数,本章我们的讨论重点就是输入变量的非线性函数的线性组合. 1 线性基 ...
- 第六题 Z字走法
我和答案第一种解法是很相似的 但是时间 和空间都被大部分人击败了. 思路就是用一个标记 为0就竖着走 为1就斜着走 把二维数组填满 我觉得难点在于PHYTON如何创建一个二维数组 而且是不定长的 ...
- Chrome:查看HTTP请求的header信息
1.打开Google浏览器Chrome,通过F12进入开发者工具,进入Network模块下,此时由于我们还没有进行任何HTTP请求,所以这个页面下还是空空如也 2.随便通过某个搜索引擎搜索一下,比如通 ...
- JavaWeb-数据库基础
数据库基础 推荐阅读: 数据库:https://www.cnblogs.com/zwtblog/tag/数据库/ 数据库是学习JavaWeb的一个前置,只有了解了数据库的操作和使用,我们才能更好地组织 ...
- 堪比JMeter的.Net压测工具 - Crank 入门篇
1. 前言 Crank 是.NET 团队用来运行基准测试的基准测试基础架构,包括(但不限于)来自TechEmpower Web 框架基准测试的场景,是2021年.NET Conf 大会上介绍的一项新的 ...
- JZ-058-对称的二叉树
对称的二叉树 题目描述 请实现一个函数,用来判断一棵二叉树是不是对称的.注意,如果一个二叉树同此二叉树的镜像是同样的,定义其为对称的. 题目链接: 对称的二叉树 代码 /** * 标题:对称的二叉树 ...
- 实例化类对象及类的属性set方法使用不当
类的属性中set方法操作数据库,新建类对象并给其赋值时总会触发该set方法,而导致不期望的错乱: 库位类Storage,其中传感器状态SensorStatus和逻辑状态LogicStatus有一定的关 ...
- ASP.NET Core 6框架揭秘实例演示[22]:如何承载你的后台服务[补充]
借助 .NET提供的服务承载(Hosting)系统,我们可以将一个或者多个长时间运行的后台服务寄宿或者承载我们创建的应用中.任何需要在后台长时间运行的操作都可以定义成标准化的服务并利用该系统来承载,A ...
- 面试题 正则表达式 验证邮箱 Pattern.matches
故事背景 今天面试遇到这道题,对正则表达式还是有些懵,面试完回家复盘实现一下.这里使用到了 Pattern 这个类来校验正则表达式. 正则表示式分析: ^([a-z0-9A-Z]+[-|\\.]?)+ ...
- 微信小程序 app.js globalData 赋值报错
//success方法要用用success: res => {}的格式 success: res => { } //赋值报错 success:function(e){ } //报错内容: ...