·ÖÏí

flume ²å¼þ¿ª·¢½éÉÜ

ÎÊÌâµ¼¶Á£º
ÈçºÎ¿ª·¢sink²å¼þ£¿
²å¼þ¿ª·¢Íê±ÏÈçºÎ¼ÓÈëµ½flumeÖУ¿







flume²å¼þ¿ª·¢Ò»°ã·ÖÈçϲ½Öè

1 ±àд²å¼þÀࣨSink/Source/Decorator£©ÏàÓ¦µÄ¼Ì³ÐflumeµÄ£¨EventSink.Base/ EventSource.Base/EventSinkDecorator<S>£©

Source±ØÐëʵÏÖËĸö·½·¨£º
void open() throws IOException
Event next() throws IOException
void close() throws IOException
ReportEvent getReport()

SinkºÍDecorator±ØÐëʵÏÖËĸö·½·¨£º
         voidopen() throws IOException
        void append(Event e) throws IOException
        void close() throws IOException
        ReportEvent getReport()

Ö÷Òª½éÉÜsink²å¼þµÄ¿ª·¢
append(Event e)·½·¨ÖеÄevent²ÎÊýÊÇflume¿ò¼Ü×Ô´øµÄÀ࣬ÈÕÖ¾ÎļþµÄÒ»ÐмǼ»áÔÚflume¿ò¼ÜÖзâ×°³ÉÒ»¸öevent£¬ÔÚappend·½·¨ÖжÔeventµÄ´¦Àí¾Í¿ÉÒÔµ±×öÊÇ´¦ÀíÈÕÖ¾ÎļþµÄÿһÐУ¬Event°üº¬µÄÁù¸öÊôÐÔÊÇ£º
  • Unixtimestamp  Ê±¼ä´Á
  • Nanosecondtimestamp
  • Priority
  • Sourcehost Ö÷»úµØÖ·£¨Õâ¸öµØÖ·ÊDzúÉúÈÕÖ¾µÄÎļþµØÖ·£©
  • Body ÈÕÖ¾ÎļþµÄÒ»ÐÐ
  • Metadatatable with an arbitrary number of attribute value pairs.

ÔÚsinkµÄ²å¼þÀàÖÐÒ»¶¨ÒªÊǼÓÈëÏÂÃæµÄ´úÂ룺
   
  1. public static List<Pair<String, SinkBuilder>> getSinkBuilders() {
  2.        List<Pair<String, SinkBuilder>> builders = new ArrayList<Pair<String, SinkBuilder>>();
  3.        builders.add(new Pair<String, SinkBuilder>("<font color="#0000ff">HBaseEventSinkV1</font>",builder()));
  4.        return builders;
  5.     }
¸´ÖÆ´úÂë

ÒòΪflumeµÄSinkFactoryImplÖÐÐèҪͨ¹ýÕâ·Ý·½·¨½«Ð´µÄ²å¼þÀà×¢²áµ½flume£¬Èç¹û²»Ð´»á±¨´í£¬"HBaseEventSinkV1" ¾ÍÊÇ×¢²áÃû
ÒÔ¿ª·¢collectorµÄ²å¼þÀàΪÀý£¬Íê³É²å¼þÀàµÄ¿ª·¢Ö®ºó£¬½«²å¼þÀà´ò°ü·Ö±ð·Åµ½masterºÍcollectorÖ÷»úÉÏ£¨×¢£º¶à¸ömasterºÍ¶à¸öcollectorµÄÇé¿öÏÂÒª¶¼·ÅÖã¬×îºÃĿ¼¶¼Ò»Ñù£¬±ãÓÚÅäÖÃflume classpath£©¡£

½«¿ª·¢µÄjar°ü¼ÓÈëµ½flumeÖÐ
·½·¨Ò» :
½øÈëvi /etc/profile ÔÚÎļþÖмÓÈë exportFLUME_CLASSPATH = XXX/XX/XXX.jar
ÔÚCALSSPATH µÄβ²¿¼ÓÈë:$FLUME_CLASSPATH , È»ºó±£´æÍ˳öºó£¬ÔÚÃüÁîÐÐÖ´ÐÐsh/etc/profile £¬Í¨¹ýÔÚÃüÁîÐÐÊäÈë flumeclasspath ²é¿´²å¼þjar°üÊÇ·ñÔÚÆäÖУ¬ÔÚÆäÖбíʾÅäÖÃÍê³É£¨×¢£º¿ª·¢²å¼þʱÒýÈëµÄjar°ü±ØÐ붼Äܹ»ÔÚflume classpathÏÂÕÒµ½£¬Èç¹ûÕÒ²»µ½µÄ»°Ïñ¼ÓÈë²å¼þ°üµÄ·½Ê½¼ÓÈ룩

·½·¨¶þ:
¼òµ¥µÄ·½·¨Êǽ«¿ª·¢µÄjar°üºÍÐèÒªÒýÈëµÄjar°üÖ±½Ó¸´ÖƵ½/usr/lib/flume/lib
ÐÞ¸Äflume-site.xmlÎļþÈçÏÂËùʾ£º
  1. <property>
  2. <name>flume.plugin.classes</name>  
  3. <value>²å¼þÀàµÃȫ·¾¶Ãû£¨È磺hello.HelloWorldSink£© </value>
  4.     <description>Comma separated list of plugin classes</description>
  5.   </property>
¸´ÖÆ´úÂë


½«flume-site.xmlÎļþ·Åµ½master ºÍcollectorµÄ/etc/flume/conf ÏÂ
Æô¶¯¼¯ÈºÅäÖü´¿É


ÒÑÓÐ(3)ÈËÆÀÂÛ

Ìøתµ½Ö¸¶¨Â¥²ã
hongqianli588 ·¢±íÓÚ 2015-5-29 12:12:41
Â¥Ö÷ÕâÊÇ»ùÓÚFlume OGµÄ°æ±¾Âð£¿

µãÆÀ

hyj
»ùÓÚflume£¬Ö»¹©²Î¿¼Ìṩ˼·  ·¢±íÓÚ 2015-5-29 12:19
»Ø¸´

ʹÓõÀ¾ß ¾Ù±¨

hongqianli588 ·¢±íÓÚ 2015-5-29 12:55:27
hongqianli588 ·¢±íÓÚ 2015-5-29 12:12
Â¥Ö÷ÕâÊÇ»ùÓÚFlume OGµÄ°æ±¾Âð£¿

¿´Ìû×Ó×îºóÌáµ½ÁË master ºÍcollector Õâ¸öÊÇFlume OG °æ±¾µÄ¶«Î÷°É£¬ºÃÏñ
Flume NGÊÇûÓÐÕâ¸ö¸ÅÄîµÄ£¬×î½üÑо¿Õâ¸ö£¬¿´µ½Õâ¸öÓеãÔΡ¢
»Ø¸´

ʹÓõÀ¾ß ¾Ù±¨

ÄúÐèÒªµÇ¼ºó²Å¿ÉÒÔ»ØÌû µÇ¼ | Á¢¼´×¢²á

±¾°æ»ý·Ö¹æÔò

¹Ø±Õ

ÍƼöÉÏÒ»Ìõ /2 ÏÂÒ»Ìõ