使用flume将csv文件写入到Kafka中

源数据文件:https://pan.baidu.com/s/1UiM8qmYY8MFKJaSLwIlPqQ提取码:apk61.在flume的conf目录下创建jobkb09目录:mkdir /opt/flume160/conf/jobkb092.进入jobkb09目录,在其中创建tmp目录,并将源数据文件均放入其中3.创建Kafka topic:events :kafka-topics.sh --create --zookeeper 192.168.134.104:2181 --topic ev
摘要由CSDN通过智能技术生成

源数据文件:https://pan.baidu.com/s/1UiM8qmYY8MFKJaSLwIlPqQ
提取码:apk6

1.在flume的conf目录下创建jobkb09目录:mkdir /opt/flume160/conf/jobkb09
2.进入jobkb09目录,在其中创建tmp目录,并将源数据文件均放入其中
3.创建Kafka topic:
events :

kafka-topics.sh --create --zookeeper 192.168.134.104:2181 --topic events --partitions 1 --replication-factor 1

event_attendees:

kafka-topics.sh --create --zookeeper 192.168.134.104:2181 --topic event_attendees --partitions 1 --replication-factor 1

train:

kafka-topics.sh --create --zookeeper 192.168.134.104:2181 --topic train --partitions 1 --replication-factor 1

user_friends:

kafka-topics.sh --create --zookeeper 192.168.134.104:2181 --topic user_friends --partitions 1 --replication-factor 1

users:

kafka-topics.sh --create --zookeeper 192.168.134.104:2181 --topic users --partitions 1 --replication-factor 1

4.编写对应需求的agent配置文件:
train-flume-kafka.conf:

train.sources=trainSource
train.channels=trainChannel
train.sinks=trainSink

train.sources.trainSource.type=spooldir
train.sources.trainSource.spoolDir=/opt/flume160/conf/jobkb09/dataSourceFile/train
train.sources.trainSource.deserializer=LINE
train.sources.trainSource.deserializer.maxLineLength=320000
train.sources.trainSource.includePattern=train_[0-9]{
  4}-[0-9]{
  2}-[0-9]{
  2}.csv
train.sources.trainSource.interceptors=head_filter
train.sources.trainSource.interceptors.head_filter.type=regex_filter
train.sources.trainSource.interceptors.head_filter.regex=^user*
train.sources.trainSource.interceptors.head_filter.excludeEvents=true

train.channels.trainChannel.type=
  • 1
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值