flume

Retrieving timestamp from hbase row

大兔子大兔子 提交于 2019-12-05 06:53:41
Using Hbase API (Get/Put) or HBQL API, is it possible to retrieve timestamp of a particular column? Assuming your client is configured and you have a table setup. Doing a get returns a Result Get get = new Get(Bytes.toBytes("row_key")); Result result_foo = table.get(get); A Result is backed by a KeyValue . KeyValues contain the timestamps. You can get either a list of KeyValues with list() or get an array with raw(). A KeyValue has a get timestamp method. result_foo.raw()[0].getTimestamp() ljp result_foo.rawCells()(0).getTimestamp is a good style I think the follow will be better: KeyValue kv

Flume的Source、Sink总结,及常用使用场景

萝らか妹 提交于 2019-12-05 06:21:23
数据源Source RPC异构流数据交换 Avro Source Thrift Source 文件或目录变化监听 Exec Source Spooling Directory Source Taildir Source MQ或队列订阅数据持续监听 JMS Source SSL and JMS Source Kafka Source Network类数据交换 NetCat TCP Source NetCat UDP Source HTTP Source Syslog Sources Syslog TCP Source Multiport Syslog TCP Source Syslog UDP Source 定制源 Custom Source Sink HDFS Sink Hive Sink Logger Sink Avro Sink Thrift Sink IRC Sink File Roll Sink HBaseSinks HBaseSink HBase2Sink AsyncHBaseSink MorphlineSolrSink ElasticSearchSink Kite Dataset Sink Kafka Sink HTTP Sink Custom Sink 案例 1、监听文件变化 exec-memory-logger.properties #指定agent的sources

在CentOS6.9中 搭建 Flume

大兔子大兔子 提交于 2019-12-05 06:19:28
之前的基本环境准备我就不再说了, 请参照我之前的搭建hadoop的文章 在CentOS 6.9中搭建Hadoop 配置 flume 环境变量 export FLUME_HOME=/opt/apache-flume-1.7.0-bin export PATH=$PATH:$JAVA_HOME/bin:$HADOOP_HOME/bin:$FLUME_HOME/bin:$HOME/bin 然后 记得 source ~/.bash_profile 根据需求,配置不同的 source/channel/sink,添加配置文件到 conf/中 flume_exec_hdfs.conf logAgent.sources = logSource logAgent.channels = fileChannel logAgent.sinks = hdfsSink logAgent.sources.logSource.type = exec logAgent.sources.logSource.command = tail -F /aura/data/flume-search/logs logAgent.sources.logSource.channels = fileChannel logAgent.sinks.hdfsSink.type = hdfs logAgent.sinks.hdfsSink

Flume和 Sqoop

♀尐吖头ヾ 提交于 2019-12-05 05:04:45
Sqoop简介 Sqoop是一种旨在有效地在Apache Hadoop和诸如关系数据库等结构化数据存储之间传输大量数据的工具 原理: 将导入或导出命令翻译成Mapreduce程序来实现。   在翻译出的Mapreduce中主要是对InputFormat和OutputFormat进行定制 RDBMS到HDFS sqoop import \ --connect jdbc:mysql://hadoop102:3306/company \ --username root \ --password 123456 \ --table staff \ --target-dir /user/company \ --delete-target-dir \ --num-mappers 1 \ --fields-terminated-by "\t" RDBMS到Hive sqoop import \ --connect jdbc:mysql://hadoop102:3306/company \ --username root \ --password 123456 \ --table staff \ --num-mappers 1 \ --hive-import \ --fields-terminated-by "\t" \ --hive-overwrite \ --hive-table staff

flume启动报错 Could not find or load main class org.apache.flume.node.Application

风流意气都作罢 提交于 2019-12-05 03:53:22
修改flume的文件夹名称后,启动flume可能会失败,错误信息如下: Error: Could not find or load main class org.apache.flume.node.Application 这个是因为环境变量的问题。 export看一下是不是有个FLUME_HOME的环境变量指向原来的文件夹, 如果是的话: unset FLUME_HOME 就行了 来源: CSDN 作者: 灵夕丨月下灵 链接: https://blog.csdn.net/xiaolong_4_2/article/details/82634694

flume保存文件到hdfs的时候报错

被刻印的时光 ゝ 提交于 2019-12-05 03:40:49
flume配置sink向hdfs中写入文件,在启动的时候遇到的报错问题 1. Failed to start agent because dependencies were not found in classpath. Error follows. java.lang.NoClassDefFoundError: org/apache/hadoop/io/SequenceFile$CompressionType [ERROR - org.apache.flume.node.PollingPropertiesFileConfigurationProvider$FileWatcherRunnable.run(PollingPropertiesFileConfigurationProvider.java:145)] Failed to start agent because dependencies were not found in classpath. Error follows. java.lang.NoClassDefFoundError: org/apache/hadoop/io/SequenceFile$CompressionType at org.apache.flume.sink.hdfs.HDFSEventSink.configure(HDFSEventSink

(2) flume 入门学习 HelloWorld 及HDFS 遇到的问题 总结

元气小坏坏 提交于 2019-12-05 03:40:29
(1) HelloWorld Starting an agent An agent is started using a shell script called flume-ng which is located in the bin directory of the Flume distribution. You need to specify the agent name, the config directory, and the config file on the command line: $ bin/flume-ng agent -n $agent_name -c conf -f conf/flume-conf.properties.template Now the agent will start running source and sinks configured in the given properties file. A simple example Here, we give an example configuration file, describing a single-node Flume deployment. This configuration lets a user generate events and subsequently

Flume NG 学习笔记(九)Flune Client 开发

自闭症网瘾萝莉.ら 提交于 2019-12-05 03:39:59
文章内容还是来自官网 http://flume.apache.org/FlumeDeveloperGuide.html 由于在实际工作中,数据的生产方式极具多样性,Flume 虽然包含了一些内置的机制来采集数据,但是更多的时候用户更希望能将应用程序和flume直接相通。所以这边运行用户开发应用程序,通过IPC或者RPC连接flume并往flume发送数据。 一、RPC client interface Flume的RpcClient实现了Flume的RPC机制。用户的应用程序可以很简单的调用Flume Client SDK的append(Event) 或者appendBatch(List<Event>) 方法发送数据,不用担心底层信息交换的细节。用户可以提供所需的event通过直接实现Event接口,例如可以使用简单的方便的实现SimpleEvent类或者使用EventBuilder的writeBody()静态辅助方法。 自Flume 1.4.0起,Avro是默认的RPC协议。NettyAvroRpcClient和ThriftRpcClient实现了RpcClient接口。实现中我们需要知道我们将要连接的目标flume agent的host和port用于创建client实例,然后使用RpcClient发送数据到flume agent。 官网给了一个Avro

flume开发-自定义拦截器(Interceptor)

大兔子大兔子 提交于 2019-12-05 03:38:29
拦截器是简单的插件式组件,设置在source和channel之间。source接收到的时间,在写入channel之前,拦截器都可以进行转换或者删除这些事件。每个拦截器只处理同一个source接收到的事件。flume官方实现了很多拦截器也可以自定义拦截器。通过实现自定义的拦截器可以对日志进行ETL。 自定义拦截器只需要实现Interceptor的继承类。具体步骤如下: 1. 实现一个Interceptor的继承类。下面的example实现了继承类ETLInterceptor. package 是com.test.flume . [java] view plain copy //add begin package com.test.flume; //add end import com.google.common.base.Charsets; import com.google.common.collect.Lists; import org.apache.flume.Context; import org.apache.flume.Event; import org.apache.flume.interceptor.Interceptor; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java

flume自定义组件的 jar 包管理

戏子无情 提交于 2019-12-05 03:36:39
自定义flume 组建后,将项目打成jar 包,关于这个jar 包的管理和使用我在这里列举了三中方式。这三种方式都可以,随自己喜好使用。 1. lib 目录 将maven项目打成jar包,将jar 包放到flume的lib 目录下。 此方法简单粗暴,缺点就是jar 包不易管理 2. 官方给定目录 官方建议在flume的 plugins.d (plugins.d 目录需要自己创建)目录下创建 一个自己定义的目录,在自定义的目录下新建 lib 和 libext 文件夹,lib 文件夹为放自定义组件的jar包,libext 文件夹下放 自定义组件的依赖包。 flume- 1.7 .0 /plugins .d / flume- 1.7 .0 /plugins .d /custom-MysqlSink/ flume- 1.7 .0 /plugins .d /custom-MysqlSink/lib/mysql-sink .jar flume- 1.7 .0 /plugins .d /custom-MysqlSink/libext/mysql-connector-java- 6.0 .5 .jar 此方法方便,易管理,就是需要自己建目录。 3. 自我管理 把jar包放在自己想放的目录,但是代价就是启动时需要通过 -C 指定jar 包位置。 在启动的时候 直接加载jar 包 ,依赖的jar