由于业务系统使用的数据库是Mysql,需要对业务进行大数据分析这就要求我们实时采集MySQL的数据。使用flume采集MySQL数据配置较简单,下面是配置的过程。
插件下载
需要的插件
- mysql-connector-java-5.1.46-bin.jar
- flume-ng-sql-source-1.4.1.jar
- 这两个软件需要拷贝到 /usr/local/flume/lib
flume配置
agent.sources.s1.type=org.keedio.flume.source.SQLSource
agent.sources.s1.hibernate.connection.url=jdbc:mysql://localhost:3306/tickapi?useOldAliasMetadataBehavior=true
agent.sources.s1.hibernate.connection.user=root
agent.sources.s1.hibernate.connection.password=123456
agent.sources.s1.hibernate.connection.autocommit=true
agent.sources.s1.hibernate.connection.driver_calss=com.mysql.jdbc.Driver
agent.sources.s1.hibernate.dialect=org.hibernate.dialect.MySQL5Dialect
agent.sources.s1.hibernate.provider_class=org.hibernate.connection.C3P0ConnectionProvider
agent.sources.s1.run.query.delay=5000
# 增量配置
# agent.sources.s1.table=lt_api_getallstops
# agent.sourc