linux下快速搭建kafka
来源:互联网 发布:java安装后无法打开jar 编辑:程序博客网 时间:2024/06/03 17:43
废话不多说,直奔主题
感谢https://www.w3cschool.cn/apache_kafka/apache_kafka_quick_guide.html
的分享。
1.安装JDK
网上一大把,随便搜一下
2.安装Zookeeper
kafka依赖于Zookeeper
2.1下载Zookeeper
地址:http://zookeeper.apache.org/releases.html
(最新的zookeeper-3.4.8.tar)
2.2解压Zookeeper
1、*.tar 用 tar -xvf 解压2、*.gz 用 gzip -d或者gunzip 解压3、*.tar.gz和*.tgz 用 tar -xzf 解压4、*.bz2 用 bzip2 -d或者用bunzip2 解压5、*.tar.bz2用tar -xjf 解压6、*.Z 用 uncompress 解压7、*.tar.Z 用tar -xZf 解压8、*.rar 用 unrar e解压9、*.zip 用 unzip 解压
命令全在这,变弄边学习下
2.3修改配置文件
把 zoo_sample.cfg 改名成zoo.cfg
$ mv zoo_sample.cfg zoo.cfg
之后修改zoo.cfg内容
$ vi conf/zoo.cfgdataDir=/var/tools/zookeeper-3.4.8/data
也就是你的zookeeper安装路径
2.4启动
$ bin/zkServer.sh start
成功的话提示如下:
$ JMX enabled by default$ Using config: ../zookeeper-3.4.8/bin/../conf/zoo.cfg$ Starting zookeeper ... STARTED
2.4关闭
$ bin/zkServer.sh stop
3.安装Kafka
3.1下载
地址:http://kafka.apache.org/downloads.html
(kafka_2.11-0.11.0.1.tgz)
3.2解压Kafka
方法同上2.2:
建议把zookeeper和kafka下载完后一起传到linux上
3.3修改 server.properties
1.修改log.dirs,改成安装路径
log.dirs=/var/tools/kafka_2.11-0.11.0.1/kafka-logs
2.添加 host.name
host.name = kafka服务所在主机的ip
不添加的话本地是连接不到kafka服务的
3.修改启动文件kafka-server-start.sh
把启动文件里的xmx和xms调小一点,默认是1G
你可以根据你的JDK设置的xmx和xms调,使启动文件里的xmx和xms不要超过JDK中设置的数值
不更改的话启动会报错count not reserve enough space for 1048576KB object heap
3.4启动服务
后台启动:
nohup bin/kafka-server-start.sh config/server.properties&
3.5创建topic
创建
bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic Hello-Kafka
显示所有topic
bin/kafka-topics.sh --list --zookeeper localhost:2181
3.6启动生产者发送消息
bin/kafka-console-producer.sh --broker-list localhost:9092 --topic test
3.7启动消费者消费消息
另起一个窗口
bin/kafka-console-consumer.sh --zookeeper localhost:2181 --topic test
3.8测试
在生产者窗口输入一条信息后 回车
消费者窗口就可以显示出来
到此OK啦~
阅读全文
0 0
- linux下快速搭建kafka
- Linux下搭建kafka环境
- Linux下搭建kafka环境
- Linux环境下搭建Kafka
- 【Linux】ubuntu下kafka集群环境搭建
- Kafka在Linux环境下搭建过程
- kafka在Linux下搭建实践
- Linux下Kafka环境的搭建
- Kafka在Linux环境下搭建过程
- Linux下搭建Kafka运行环境
- 【Linux】ubuntu下kafka集群环境搭建,kafka命令
- kafka环境的快速搭建
- linux 搭建 kafka集群
- kafka学习二:在linux环境下kafka搭建环境(单机版)
- kafka学习二:在linux环境下kafka搭建环境(单机版)
- Linux平台下快速搭建FTP服务器
- Linux平台下快速搭建FTP服务器
- Linux下快速搭建DNS服务器
- 仿微信朋友圈拍照上传
- Linux下Shell脚本的基本执行方式
- css属性width默认值width: auto与width: 100%区别
- poj1696 Space Ant (极角排序,叉积)
- C++自定义链表实现约瑟夫环
- linux下快速搭建kafka
- 第七周周中总结
- make though multi core
- hdu1753 X问题 (扩展CRT)
- SpringBoot + mybatis + Swagger快速构建REST API并生成优美的API文档
- unity_NGUI系统学习(十五)_UIInput输入框脚本的学习
- 广电智能推荐点播系统实践
- HMC 升级 V7R7.9
- SVM 调参策略