博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
kafka 安装部署
阅读量:4030 次
发布时间:2019-05-24

本文共 2020 字,大约阅读时间需要 6 分钟。

一、 安装zookeeper:
Zookeeper安装
1. 安装wget http://www.apache.org/dist//zookeeper/zookeeper-3.3.6/zookeeper-3.3.6.tar.gz
2 tar zxvf zookeeper-3.3.6.tar.gz
3 cd  zookeeper-3.3.6
4 cp conf/zoo_sample.cfg conf/zoo.cfg
 
启动:
5  ./bin/zkServer.sh start
停止:
6  ./bin/zkServer.sh stop
简单操作:
 ./bin/zkCli.sh -server 127.0.0.1:2181
[zk: 127.0.0.1:2181(CONNECTED) 2] create /test  "hello"
Created /test
[zk: 127.0.0.1:2181(CONNECTED) 3] get /test
"hello"
cZxid = 0x8
ctime = Wed Dec 28 10:03:24 CST 2016
mZxid = 0x8
mtime = Wed Dec 28 10:03:24 CST 2016
pZxid = 0x8
cversion = 0
dataVersion = 0
aclVersion = 0
ephemeralOwner = 0x0
dataLength = 7
numChildren = 0
  
二、安装kafka
1 wget 
2  tar zxvf kafka_2.11-0.10.1.0.tgz
3  cd kafka_2.11-0.10.1.0
4 bin/kafka-server-start.sh config/server.properties
测试: 参考 
5  Create a topic:
# bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test
Created topic "test".
# bin/kafka-topics.sh --list --zookeeper localhost:2181
test
后续操作参考: 
Step 4: Send some messages
Kafka comes with a command line client that will take input from a file or from standard input and send it out as messages to the Kafka cluster. By default, each line will be sent as a separate message.
Run the producer and then type a few messages into the console to send to the server.
> bin/kafka-console-producer.sh --broker-list localhost:9092 --topic test
This is a message
This is another message
Step 5: Start a consumer
Kafka also has a command line consumer that will dump out messages to standard output.
> bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic test --from-beginning
This is a message
This is another message
If you have each of the above commands running in a different terminal then you should now be able to type messages into the producer terminal and see them appear in the consumer terminal.
All of the command line tools have additional options; running the command with no arguments will display usage information documenting them in more detail.

转载地址:http://iflbi.baihongyu.com/

你可能感兴趣的文章
[Mac]Mac 操作系统 常见技巧
查看>>
苹果Swift编程语言入门教程【中文版】
查看>>
捕鱼忍者(ninja fishing)之游戏指南+游戏攻略+游戏体验
查看>>
iphone开发基础之objective-c学习
查看>>
iphone开发之SDK研究(待续)
查看>>
计算机网络复习要点
查看>>
Variable property attributes or Modifiers in iOS
查看>>
NSNotificationCenter 用法总结
查看>>
C primer plus 基础总结(一)
查看>>
剑指offer算法题分析与整理(一)
查看>>
剑指offer算法题分析与整理(三)
查看>>
部分笔试算法题整理
查看>>
Ubuntu 13.10使用fcitx输入法
查看>>
pidgin-lwqq 安装
查看>>
mint/ubuntu安装搜狗输入法
查看>>
C++动态申请数组和参数传递问题
查看>>
opencv学习——在MFC中读取和显示图像
查看>>
retext出现Could not parse file contents, check if you have the necessary module installed解决方案
查看>>
pyQt不同窗体间的值传递(一)——对话框关闭时返回值给主窗口
查看>>
linux mint下使用外部SMTP(如网易yeah.net)发邮件
查看>>