13(flume安裝)
阿新 • • 發佈:2020-09-02
1,安裝flume
node0002
cd /software 上傳apache-flume-1.6.0-bin.tar.gz
tar xfapache-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