"OD Big Data Combat" flume combat

Source: Internet
Author: User

First, Netcat source + memory Channel + logger SINK1. Modify Configuration

1) Modify the flume-env.sh file under $flume_home/conf, modify the contents as follows

Export JAVA_HOME=/OPT/MODULES/JDK1. 7. 0_67

2) under the $flume_home/conf directory, create the agent subdirectory, creating a new netcat-memory-logger.conf with the following configuration:

# netcat-memory-logger# Name The components in this agenta1.sources=r1a1.sinks=K1a1.channels=c1# Describe/Configure the Sourcea1.sources.r1.type=Netcata1.sources.r1.bind= beifeng-hadoop- GenevaA1.sources.r1.port=44444# Describe The Sinka1.sinks.k1.type=logger# use a channelwhichBuffers EventsinchMemorya1.channels.c1.type=memorya1.channels.c1.capacity= +a1.channels.c1.transactionCapacity= -# Bind The source and sink to the Channela1.sources.r1.channels=C1a1.sinks.k1.channel= C1
2. Start Flume and test

1) Start

Bin/flume-ng agent-n a1-c conf/-F Conf/agent/netcat-memory-logger.conf-dflume.root.logger=info,console

2) Testing

NC beifeng-hadoop-44444

Enter any string and observe the server's log file.

Use the NC command of Linux and install it first if the command does not exist.

Installing Netcat:sudo yum-y Install NC

Second, Agent:avro source + file Channel + HDFs sink 

1. Add Configuration

Under the $flume_home/conf directory, create the agent subdirectory, creating a new avro-file-hdfs.conf with the following configuration:

# Name The components in this agenta1.sources=r1a1.sinks=K1a1.channels=c1# Describe/Configure the Sourcea1.sources.r1.type=Netcata1.sources.r1.bind= beifeng-hadoop- GenevaA1.sources.r1.port=4141# Describe The Sinka1.sinks.k1.type=Hdfsa1.sinks.k1.hdfs.path= HDFs://beifeng-hadoop-02:9000/flume/events/%y-%m-%d# Default:FlumeDataa1.sinks.k1.hdfs.filePrefix=FlumeDataa1.sinks.k1.hdfs.useLocalTimeStamp=trueA1.sinks.k1.hdfs.rollInterval=0A1.sinks.k1.hdfs.rollCount=0# generally close to block -  -  thea1.sinks.k1.hdfs.rollSize=10240A1.sinks.k1.hdfs.fileType=Datastream#a1.sinks.k1.hdfs.round=true#a1. Sinks.k1.hdfs.roundValue=Ten#a1. Sinks.k1.hdfs.roundUnit=minute# use a channelwhichBuffers EventsinchMemorya1.channels.c1.type=fileA1.channels.c1.checkpointDir=/opt/modules/cdh/apache-flume-1.5.0-cdh5.3.6-bin/Checkpointa1.channels.c1.dataDirs=/opt/modules/cdh/apache-flume-1.5.0-cdh5.3.6-bin/data# Bind The source and sink to the Channela1.sources.r1.channels=C1a1.sinks.k1.channel= C1

2. Start and test

1) Start Flume agent

Bin/flume-ng agent-n a1-c conf/-F conf/agent/avro-file-hdfs.conf-dflume.root.logger=info,console

2) avro-client test with Flume

Bin/flume-ng avro-client--host beifeng-hadoop-4141 --filename/home/beifeng/order_info.txt

"OD Big Data Combat" flume combat

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.