Flume is a distributed, reliable and advisable service for efficiently collecting, aggregating and moving large amounts of streaming event data.
It is a distributed data collection service that gets flow of data from their source and aggregates them to where they have to be processed.
It was designed to handle log data solely, but later, it was developed to process event data.
The three main component in Flume flow is,
- Source
- Channel
- Sink
Before that, let us see the working flow of Flume.
Six Steps of Flume Configuration file creation:
- First step is to decide the name of the agent.
- In the Second step, we need to Setup the Source.
- In the Third step, we need to Setup the Channel.
- The forth step is to Setup the Sink.
- Fifth step is, Connect Source with Channel and Sink with Channel.
- The sixth step, that is the final step is to Execute the Configuration.
vi configfilename.conf
Step2:
we need to write the below code and that can be referred from the Flume manual.
#Create variable of 3 components:
AgentName.Sources=getFromNetcat
AgentName.Channels=getToRAM
AgentName.Sinks=writetoHDFS#Configure The Source:
AgentName.Sources.getFromNetcat.type=netcat
AgentName.Sources.getFromNetcat.bind={Ipaddress}
AgentName.Sources.getFromNetcat.port={portnumber}#Configure The Channel:
AgentName.Channel.goToRAM.type=memory.
#Configure The Sink:
AgentName.Sinks.writetoHDFS.type=hdfs
AgentName.Sinks.writetoHDFS.hdfs.path={path}
AgentName.Sinks.writetoHDFS.hdfs.writeFormat=Text
AgentName.Sinks.writetoHDFS.hdfs.fileType=DataStream#Connect Source With Channel:
AgentName.Sources.getFromNetcat.Channels=goToRAM
#Connect sink with channel:
AgentName.Sinks.writetoHDFS.channel=goToRAM
Note in the above example the data that is mention in { } it is the data that needs to be provided by the user. That is it needs to be configured by the user.
Step3:
We have created the config file as shown above. Now, we need to run it by below command
flume-ng agent --name AgentName -f configfilename.conf
Thus, we have seen the overview of Flume and a simple example to create the configuration file for flume. Hope it will be helpful. You can follow this page by clicking follow button on the top right of the screen. You can also follow us on the social media via social media plugin given above the follow button.
Thank You !!!
0 Comments