一 安装包二 Zookeeper
2.1 修改2.2 启动 三 Kafka
2.1 修改2.2 启动2.3 测试
2.3.1 创建 Topic2.3.1 创建生产者2.3.2 创建消费者2.3.3 测试 四 Flume
4.1 配置
4.1.1 Flume配置4.1.2 系统环境配置4.1.3 验证 4.2 测试
4.2.1 制造数据4.2.2 写配置
一 安装包本文安装在 /root/study 下
二 Zookeeper 2.1 修改修改 /root/study/zookeeper/conf 中的 zoo_sample.cfg
1.重命名为 zoo.cfg
2.编辑内容
1.进入 bin 目录
cd /root/study/zookeeper/bin
2.启动
./zkServer.sh start
3.检验
#查看状态 ./zkServer.sh status #查看端口 lsof -i:2181三 Kafka 2.1 修改
修改 /root/study/kafka/config 的 server.properties
改动后:
# 34 行 listeners=PLAINTEXT://192.168.200.128:9092
# 128 行 zookeeper.connect=192.168.200.128:21812.2 启动
cd /root/study/kafka/bin ./kafka-server-start.sh ../config/server.properties2.3 测试 2.3.1 创建 Topic
新建 终端A
topic 名为 test
cd /root/study/kafka/bin ./kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test
查看
./kafka-topics.sh --list --zookeeper localhost:21812.3.1 创建生产者
新建 终端B
cd /root/study/kafka/bin ./kafka-console-producer.sh --broker-list localhost:9092 --topic test2.3.2 创建消费者
新建 终端C
cd /root/study/kafka/bin ./kafka-console-consumer.sh --zookeeper localhost:2181 --topic test2.3.3 测试
在终端B中输入,终端C中能显示。
四 Flume 4.1 配置 4.1.1 Flume配置1.进入 conf 目录
/root/study/flume/conf
2.将 flume-env.sh.template 重命名为 flume-env.sh
3.修改 flume-env.sh
#写入 export JAVA_HOME=/usr/local/jdk/jdk1.8.0_1814.1.2 系统环境配置
1.打开环境变量
vi /etc/profile
2.在 profile 中新增
#Flume export FLUME_HOME=/root/study/flume export PATH=$PATH:$FLUME_HOME/bin
3.使新的环境变量生效
source /etc/profile4.1.3 验证
cd /root/study/flume/bin ./flume-ng version4.2 测试 4.2.1 制造数据
1.进入 flume 目录
cd /root/study/flume
2.新建 logs 文件夹
3.新建 test.log 文件,并任意输入
1.进入目录
cd /root/study/flume/conf
2.新建 test.conf 文件并写入
#Name the components on this agent a1.sources= r1 a1.sinks= k1 a1.channels= c1 #Describe/configure the source a1.sources.r1.type = exec a1.sources.r1.command = tail -F /root/study/flume/logs/test.log a1.sources.r1.channels = c1 #Describe the sink #a1.sinks.k1.type= logger a1.sinks.k1.type=org.apache.flume.sink.kafka.KafkaSink a1.sinks.k1.brokerList=localhost:9092 a1.sinks.k1.topic=test a1.sinks.k1.channel= c1 #Use a channel which buffers events in memory a1.channels.c1.type= memory a1.channels.c1.capacity= 1000 a1.channels.c1.transactionCapacity= 100
3.在终端E输入
bin/flume-ng agent -c /root/study/flume/conf -f /root/study/flume/conf/test.conf -n a1 -Dflume.root.logger=info,console
4.在终端C(消费者)查看



