13(flume安装)

1,安装flume

node0002

cd /software     上传apache-flume-1.6.0-bin.tar.gz

tar xf apache-flume-1.6.0-bin.tar.gz -C /opt/sxt/

cd /opt/sxt/apache-flume-1.6.0-bin/conf

mv flume-env.sh.template flume-env.sh

echo $JAVA_HOME     获取环境变量

vi flume-env.sh     (修改里面的JAVA_HOME)

2,flume连接kafka配置

vi fk.conf      (conf文件夹下创建文件)

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

# Describe/configure the source
a1.sources.r1.type = avro
a1.sources.r1.bind = node0002
a1.sources.r1.port = 41414

# Describe the sink
a1.sinks.k1.type = org.apache.flume.sink.kafka.KafkaSink
a1.sinks.k1.topic = testflume
a1.sinks.k1.brokerList = node0002:9092,node0003:9092,node0004:9092
a1.sinks.k1.requiredAcks = 1
a1.sinks.k1.batchSize = 20

# Use a channel which buffers events in memory
a1.channels.c1.type = memory
a1.channels.c1.capacity = 1000000
a1.channels.c1.transactionCapacity = 10000

# Bind the source and sink to the channel
a1.sources.r1.channels = c1
a1.sinks.k1.channel = c1

3,启动kafka

zkServer.sh start      三台机器

cd /opt/sxt/k*   三台机器

./bin/kafka-server-start.sh ./config/server.properties    (三台机器都启动)

node0002重开窗口:

cd /opt/sxt/apache-flume-1.6.0-bin/bin

bin/flume-ng agent -n a1 -c conf -f conf/fk.conf -Dflume.root.logger=DEBUG,console

posted @ 2020-09-02 20:17  bug开发工程师  阅读(102)  评论(0编辑  收藏  举报