How to install Apache Flume in Hadoop 3 on Ubuntu/Debian

 


  • INSTALASI FLUME

Pertama Instalasi FLUME pada dokumentasi flume:

wget https://downloads.apache.org/flume/1.9.0/apache-flume-1.9.0-bin.tar.gz



kemudian Extract:

#tar xzf apache-flume-1.9.0-bin.tar.gz

ubah nama hasil Extract

#mv apache-flume-1.9.0-bin flume

kemudian pindahkan:

#mv flume /opt/

kemudian tambahkan bashrc untuk FLUME direktori:

export FLUME_HOME=/opt/flume 

export FLUME_CONF_DIR=${FLUME_HOME}/conf 

export FLUME_CLASSPATH=$FLUME_CONF_DIR

export PATH=$PATH:$FLUME_HOME/bin

Kemudian Aktifkan path yang dibuat tadi:

#sudo ln -sf /etc/profile /root/.bashrc

#source /etc/profile

Kemudian Ubah ENV.sh dan masukka direktori java

#mv /opt/flume/conf/flume-env.sh.template /opt/flume/conf/flume-env.sh

#nano /opt/flume/conf/flume-env.sh



#export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64/jre/



 

Setelah itu cek version:

#flume-ng version

#hadoop fs -mkdir /flume


  • SENDING DATA LOG / TEXT to HDFS

Pertama buat properties file untuk konfigurasi:

#nano /opt/flume/conf/flume3-conf.properties




lalu isi dengan :

a1.sources = r1
a1.sinks = k1
a1.channels = c1
# Describe/configure the source
a1.sources.r1.type = netcat
a1.sources.r1.bind = localhost
a1.sources.r1.port = 44444
# Describe the sink
# Describe the sink:
a1.sinks.k1.type = hdfs
a1.sinks.k1.hdfs.path = hdfs://platform-iot:9820/flume
a1.sinks.k1.hdfs.roll.Interval = 30
a1.sinks.k1.hdfs.writeFormat = Text
a1.sinks.k1.hdfs.fileType = DataStream
#a1.sinks.k1.type = logger
# Use a channel which buffers events in memory
a1.channels.c1.type = memory
a1.channels.c1.capacity = 1000
a1.channels.c1.transactionCapacity = 100
# Bind the source and sink to the channel
a1.sources.r1.channels = c1
a1.sinks.k1.channel = c1

 




Kemudian masuk ke flume direktori:

#cd /opt/flume/bin

#./flume-ng agent -n a1 -c conf -f /opt/flume/conf/flume3-conf.properties -Dflume.root.logger=INFO,console




nah setelah itu kita kirimkan text melalui telnet seperti ini:



maka akan muncul seperti ini yang mendakan terkirim ke HDFS.


Lalu cek melalui LS atau web hadoop




 

Post a Comment

0 Comments