电信项目 第一天

模拟生成数据略

 

配置flume kafka 接受数据 让hbase消费

zookeeper 地址

192.168.36.139:2181,192.168.36.139:2182,192.168.36.139:2183

 

kafka创建主题

kafka-topics.sh --zookeeper 192.168.36.139:2181,192.168.36.139:2182,192.168.36.139:2183 --topic calllog --create --replication-factor 1 --partitions 4

启动flume

$ bin/flume-ng agent --conf conf/ --name a1 --conf-file jobs/flume-kafka.conf  

 

a1.sources = r1
a1.sinks = k1
a1.channels = c1

# source
a1.sources.r1.type = exec
a1.sources.r1.command = tail -F -c +0 /home/hadoop/calllog/calllog.csv
a1.sources.r1.shell = /bin/bash -c

# sink
a1.sinks.k1.type = org.apache.flume.sink.kafka.KafkaSink
a1.sinks.k1.brokerList = hadoop000:9092,hadoop000:9093,hadoop000:9094
a1.sinks.k1.topic = calllog
a1.sinks.k1.batchSize = 20
a1.sinks.k1.requiredAcks = 1

# channel
a1.channels.c1.type = memory
a1.channels.c1.capacity = 1000
a1.channels.c1.transactionCapacity = 100

# bind
a1.sources.r1.channels = c1
a1.sinks.k1.channel = c1

 

启动kafka消费者进行测试

kafka-console-consumer.sh --zookeeper 192.168.36.139:2181,192.168.36.139:2182,192.168.36.139:2183 --topic calllog --from-beginning

 

 

你可能感兴趣的:(电信项目 第一天)