flume-ng 入 oracle,flume-ng-sql-source

支持oracle

=======

flume-ng-sql-source

This project is used for flume-ng to communicate with sql databases

Current sql database engines supported

After the last update the code has been integrated with hibernate, so all databases supported by this technology should work.

Compilation and packaging

$ mvn package

Deployment

Copy flume-ng-sql-source-.jar in target folder into flume plugins dir folder

$ mkdir -p $FLUME_HOME/plugins.d/sql-source/lib $FLUME_HOME/plugins.d/sql-source/libext

$ cp flume-ng-sql-source-0.8.jar $FLUME_HOME/plugins.d/sql-source/lib

Specific installation by database engine

MySQL

Download the official mysql jdbc driver and copy in libext flume plugins directory:

$ wget https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-5.1.35.tar.gz

$ tar xzf mysql-connector-java-5.1.35.tar.gz

$ cp mysql-connector-java-5.1.35-bin.jar $FLUME_HOME/plugins.d/sql-source/libext

Microsoft SQLServer

Download the official Microsoft 4.1 Sql Server jdbc driver and copy in libext flume plugins directory:

Download URL: https://www.microsoft.com/es-es/download/details.aspx?id=11774

$ tar xzf sqljdbc_4.1.5605.100_enu.tar.gz

$ cp sqljdbc_4.1/enu/sqljdbc41.jar $FLUME_HOME/plugins.d/sql-source/libext

IBM DB2

Download the official IBM DB2 jdbc driver and copy in libext flume plugins directory:

Download URL: http://www-01.ibm.com/support/docview.wss?uid=swg21363866

Configuration of SQL Source:

Mandatory properties in bold

Property Name

Default

Description

channels

-

Connected channel names

type

-

The component type name, needs to be org.keedio.flume.source.SQLSource

hibernate.connection.url

-

Url to connect with the remote Database

hibernate.connection.user

-

Username to connect with the database

hibernate.connection.password

-

Password to connect with the database

table

-

Table to export data

status.file.name

-

Local file name to save last row number read

status.file.path

/var/lib/flume

Path to save the status file

start.from

0

Start value to import data

delimiter.entry

,

delimiter of incoming entry

enclose.by.quotes

true

If Quotes are applied to all values in the output.

columns.to.select

*

Which colums of the table will be selected

run.query.delay

10000

ms to wait between run queries

batch.size

100

Batch size to send events to flume channel

max.rows

10000

Max rows to import per query

read.only

false

Sets read only session with DDBB

custom.query

-

Custom query to force a special request to the DB, be carefull. Check below explanation of this property.

hibernate.connection.driver_class

-

Driver class to use by hibernate, if not specified the framework will auto asign one

hibernate.dialect

-

Dialect to use by hibernate, if not specified the framework will auto asign one. Check https://docs.jboss.org/hibernate/orm/4.3/manual/en-US/html/ch03.html#configuration-optional-dialects for a complete list of available dialects

hibernate.connection.provider_class

-

Set to org.hibernate.connection.C3P0ConnectionProvider to use C3P0 connection pool (recommended for production)

hibernate.c3p0.min_size

-

Min connection pool size

hibernate.c3p0.max_size

-

Max connection pool size

default.charset.resultset

UTF-8

Result set from DB converted to charset character encoding

Standard Query

If no custom query is set, SELECT FROM

Custom Query

A custom query is supported to bring the possibility of using the entire SQL language. This is powerful, but risky, be careful with the custom queries used.

To avoid row export repetitions use the $@$ special character in WHERE clause, to incrementaly export not processed rows and the new ones inserted.

IMPORTANT: For proper operation of Custom Query ensure that incremental field will be returned in the first position of the Query result.

Example:

agent.sources.sql-source.custom.query = SELECT incrementalField,field2 FROM table1 WHERE incrementalField > $@$

Configuration example

# For each one of the sources, the type is defined

agent.sources.sqlSource.type = org.keedio.flume.source.SQLSource

agent.sources.sqlSource.hibernate.connection.url = jdbc:db2://192.168.56.70:50000/sample

# Hibernate Database connection properties

agent.sources.sqlSource.hibernate.connection.user = db2inst1

agent.sources.sqlSource.hibernate.connection.password = db2inst1

agent.sources.sqlSource.hibernate.connection.autocommit = true

agent.sources.sqlSource.hibernate.dialect = org.hibernate.dialect.DB2Dialect

agent.sources.sqlSource.hibernate.connection.driver_class = com.ibm.db2.jcc.DB2Driver

#agent.sources.sqlSource.table = employee1

# Columns to import to kafka (default * import entire row)

#agent.sources.sqlSource.columns.to.select = *

# Query delay, each configured milisecond the query will be sent

agent.sources.sqlSource.run.query.delay=10000

# Status file is used to save last readed row

agent.sources.sqlSource.status.file.path = /var/log/flume

agent.sources.sqlSource.status.file.name = sqlSource.status

# Custom query

agent.sources.sqlSource.start.from = 19700101000000000000

agent.sources.sqlSource.custom.query = SELECT * FROM (select DECIMAL(test) * 1000000 AS INCREMENTAL, EMPLOYEE1.* from employee1 UNION select DECIMAL(test) * 1000000 AS INCREMENTAL, EMPLOYEE2.* from employee2) WHERE INCREMENTAL > $@$ ORDER BY INCREMENTAL ASC

agent.sources.sqlSource.batch.size = 1000

agent.sources.sqlSource.max.rows = 1000

agent.sources.sqlSource.delimiter.entry = |

agent.sources.sqlSource.hibernate.connection.provider_class = org.hibernate.connection.C3P0ConnectionProvider

agent.sources.sqlSource.hibernate.c3p0.min_size=1

agent.sources.sqlSource.hibernate.c3p0.max_size=10

# The channel can be defined as follows.

agent.sources.sqlSource.channels = memoryChannel

Known Issues

An issue with Java SQL Types and Hibernate Types could appear Using SQL Server databases and SQL Server Dialect coming with Hibernate.

Something like:

org.hibernate.MappingException: No Dialect mapping for JDBC type: -15

Use org.keedio.flume.source.SQLServerCustomDialect in flume configuration file to solve this problem.

Special thanks

Version History

Version 1.5.1 added charset encoding for result set is now configurable.

Stable version is 1.5.0 (compatible with Apache Flume 1.8.0)

Previous stable version is 1.4.3 (compatible with Apache Flume prior to 1.7.0)

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/563267.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

php 500 yii,yii2.0出现500错误怎么办

1、首先开启web/index.php defined(YII_DEBUG) or define(YII_DEBUG, true); 将此改为true;看下报错的问题:Exception (Invalid Configuration) yii\base\InvalidConfigException with message The directory is notwritable by the Web process: /home/…

监控视图 oracle,Oracle“并行执行”之四——监控视图

摘自《VLDB and Partitioning Guide》1、视图介绍V$PX_BUFFER_ADVICE提供所有并行查询的BUFFER的历史使用情况,以及相关的建议规划。对于并行执行过程中的内存不足等问题,可以查询这个视图以便能够重新配置一下SGA。V$PX_SESSION提供关于并行进程会话、服…

受迫阻尼 matlab 仿真,MATLAB系统仿真报告——有阻尼受迫振动系统

一、 问题描述有阻尼受迫振动的结构及基本原理图一 有阻尼的受迫振动系统图1为有阻尼的受迫振动系统,质量为M,摩擦系数为B, 弹簧倔强系数为K。拉力、摩擦力和弹簧力三都影响质量为M的物体的加速度。如果系统的能量守恒,且振动一旦…

oracle acfs snap 恢复,删除ACFS系统碰到的问题

首先尝试UMOUNT文件系统:[oraclexsh-server1 ~]$ df -kFilesystem 1K-blocks Used Available Use% Mounted on/dev/mapper/VolGroup00-LogVol00 435653856 192338280 220828536 47% //dev/sda1 101086 16919 78948 18% /boottmpfs 65968984 195784 65773200 1% /dev…

php 数组 定义 遍历,php针对数组的定义、遍历及删除

本篇文章主要介绍php针对数组的定义、遍历及删除,感兴趣的朋友参考下,希望对大家有所帮助。本文实例讲述了php实现搜索一维数组元素并删除二维数组对应元素的方法,具体如下:定义一个一维数组一个二维数组如下$fruitarray(apple,or…

Linux怎么对文件内容trim,Linux平台下SSD的TRIM指令的最佳使用方式(不区别对待NVMe)...

SSD写数据会出现什么问题SSD读写的单位不是位,而是一个块。如果要改变这个块中的一位,首先要将整个块擦写成1,然后再写入更新的数据。为了解决擦写块的低效,SSD的策略是将需要改写的块,读取出来,进行数据修…

linux+目录+配额,Linux磁盘配额管理

最近在做基于mesosmarathon 的docker 容器云服务项目。需要限制每个容器的数据卷磁盘使用,对此作了一些调研工作。基本说明必要条件XFS ext4 均可支持Quota 操作需要内核Linux 2.4 的支持需mount时指定quota option, 可配置 /etc/fstab 后remount.有 3 种不同的配额…

linux进程运行队列,Linux进程调度中队列的使用

Linux内核中大量使用了队列,这里仅列举它在进程调度中的几处应用。Linux内核中的队列是以双链表的形式连接起来的,include/linux/list.h中定义了队列并提供了一些接口,详细的介绍可以参考**[1]**中的附录。Linux中的进程有如下几个主要状态&a…

linux命令行如何上翻,Linux学习教程-获取可用命令行参数 or 文件上下翻转和左右翻转...

导读前面使用的,有几个用到了参数如ls -l, head -n 6等,需要注意的是跟参数之间要有空格。获取可用命令行参数终端运行man ls可以查看ls所有可用的参数,上下箭头翻页,按q退出查看。(man: manual, 手册)ctehbio:~/data$ man lsNAME…

制作 小 linux 教程,用BusyBox制作Linux最小系统

1、下载busybox-1.30.1 地址:https://busybox.net/downloads/busybox-1.30.1.tar.bz22、解压:tar xvf busybox-1.30.1.tar.bz23、安装交叉编译器4、安装libncurses5-dev:sudo apt-get install libncurses5-dev5、配置busybox:make…

用微PE安装KALI LINUX到U盘,【U盘安装kali】U盘 kali pe三合一教程!装机,存储

最近发现U盘可以做出pekali正常u盘的结合教程,并且可以正常当做U盘使用,但是在网上各种教程下我出现了各种问题,整整三天捣鼓,终于实现了这个操作,并且解决了persistence存储问题!现在将来以最详细的图文来…

linux中iconv函数,Linux下编码转换(iconv函数族)

转自:http://www.linuxdiyf.com/viewarticle.php?id45164在Linux上进行编码转换时,既可以利用iconv函数族编程实现,也可以利用iconv命令来实现(针对文件进行转换)一、利用iconv函数族进行编码转换iconv函数族的头文件是iconv.h使用前需包含之…

linux下mips裸机编译,裸机交叉编译器输入

裸机交叉编译器的输入限制是什么…因为它不编译带有指针或mallocs的程序…或任何需要比底层硬件更多的东西….还有1如何找到这些局限性..我还想问一下…我为目标mips构建了交叉编译器..我需要使用此交叉编译器创建mips可执行文件…但是我无法找到可执行文件的位置…我找到了mip…

linux dns中文域名,Linux 搭建中文域名的DNS服务器

配置之前先来解释一下中文域名是如何工作的:当我们在浏览器上输入 朝阳.北京.中国 这个域名的时候 浏览器会把中文域名翻译成Punycode编码然后再传送给DNS服务器解析,例如 朝阳.北京.中国 翻译成Punycode编码以后就是xn--tpv116h.xn--1lq90i.xn--fiqs8s朝…

linux 脚本自动编制工具,全自动工具链编译脚本

GCC 工具链自动编译脚本本工具用于自动编译指定的工具链,可以同时生成运行于本机系统 (Build system) 和 Windows 系统(可以修改)的两套工具链具体编译规则指定于 .config 中defconfig 目录包含一些预定义的规则,将其复制到脚本根目录并改名为 .config 后…

linux内核全局变量同名,Linux系统下DSO同名全局变量浅析

最近重温了一下《程序员修养》,又搞懂了一些叽里旮旯的问题,现将DSO同名全局变量问题进行简单小结,具体的讲解请看《程序员修养》一书。程序员的自我修养—链接、装载与库.pdf版下载在Linux公社的1号FTP服务器里,下载地址&#xf…

node的ws的api详细讲解

WebSocket是一种在单个TCP连接上进行全双工通信的协议。Node.js中的ws模块提供了WebSocket的实现,使得Node.js可以轻松地创建WebSocket服务器和客户端。 在ws模块中,WebSocket客户端由WebSocket类实现。WebSocket提供了一系列的API,用于管理…

linux切换到字符界面stemctl,CentOS7两种模式

1.13 救援模式忘记root用户密码修改密码: 单用户模式(但只能物理机操作不能远程操作,gaub没加密或者知道gaub才能修改)忘记root用户密码修改密码: 单用户模式(但只能物理机操作不能远程操作,gaub没加密或者知道gaub才能修改)关机 …

c语言编程15,c语言编程15题.doc

——————日历问题——————#includeint xing(int year);int run(int year);int main(){int year;int yue[12]{31,28,31,30,31,30,31,31,30,31,30,31};int xingqi[12];int i,j,k;printf("可以计算公元前的\n请输入年份:");scanf("%d",&year);yea…

东北大学c语言真题及答案,东北大学C语言总测试题(含答案).pdf

C语言总测试题 计算机编程引论(C语言)1.一个C程序的执行是从: 备注及演草:A)本程序的main函数开始,到main函数结束B)本程序文件的第一个函数开始,到本程序文件的最后一个函数结束C)本程序的main函数开始,到本程序文件的…