3.Flume Simple Application-netcat

Source: Internet
Author: User

1. Install Netcat

Rpm-ivh./*.rpm

Restart xineted

./etc/rc.d/init.d/xineted Restart

2. Using the flume command

$ bin/flume-ng usage:bin/flume-ng <command> [options] ... commands:agent run a flume agent Global options:--conf,-c <conf> use configs in <conf> directory-dproperty=value sets A Java system property value Agent options:--name,-n <name> The name of this agent (required)--conf- File,-f <file> Specify a config file (required if-z missing) >>>>>>>>>>>> >>>>>>>>>>>>>> command Format bin/flume-ng agent--conf conf--name agent-test--  Conf-file test.conf bin/flume-ng agent-c conf-n agent-test-f test.conf —————————————————————— * * * Config file * * * * * * ————————— # The

Configuration file needs to define the sources, # The channels and the sinks. ### Define Agent a1.sources = R1 A1.channels = C1 A1.sinks = K1 ### define sources-A1.sources.r1.type = Netcat a1.sources . R1.bind = HADOOP-SENIOR-CDH A1.sources.r1.port = 44444 ### definels a1.channels.c1.type = Memory A1.channels.c1.capacity = 1000 a1.channels.c1.transactionCapacity = m ### define sink a 1.sinks.k1.type = Logger A1.sinks.k1.maxBytesToLog = 2014 ### bind the Soures and sink to the channel Nels = C1 A1.sinks.k1.channel = C1.

3. Run
(1) In the Flume directory execution

Bin/flume-ng Agent \-
c conf \
n A1 \
F conf/a1.conf \
-dflume.root.logger=debug,console

(2) View port, start 44444 port

NETSTAT-TNLP
TCP  0  0:: ffff:192.168.88.131:44444:::*            LISTEN      3278/java   

(3) sending data over 44444 ports

Telnet HADOOP-CDH 44444
trying 192.168.88.131 ...
Connected to HADOOP-CDH.
Escape character is ' ^] '.
AA
OK
Hello flume
ok
hi
ok

(4) received the message

2017-05-02 04:20:42,369 (sinkrunner-pollingrunner-defaultsinkprocessor) [INFO- Org.apache.flume.sink.LoggerSink.process (loggersink.java:70)] Event: {headers:{} body:68 6C 6C 6F 6C 6D 65 0 D             Hello Flume.}

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.