Logstash input输入 jdbc插件

Logstash  jdbc作为输入,从数据库输出到Elasticsearch

Logstash input输入 jdbc插件

logstash-7.2.0

以mysql为例

1、先看总体配置mysql.conf

执行时请去除所有中文注释


input {
  jdbc {
    #mysql-jdbc驱动位置
	jdbc_driver_library => "/opt/logstash/config/jdbc/mysql-connector-java.jar"
	#mysql-jdbc驱动
	jdbc_driver_class => "com.mysql.jdbc.Driver"
	#数据库URL
	jdbc_connection_string => "jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=utf8"
	#数据库有户名
	jdbc_user => "lucky"
	#数据库密码
	jdbc_password => "123456"
	#分页查询
	jdbc_paging_enabled => "true"
	#分页大小
	jdbc_page_size => "320000"
	#是否强制标识符字段的小写形式
    lowercase_column_names => false
	#多久执行一次,不配置,就执行一次
	#schedule => "0 4 * * *"
	statement => "select * from test"
    }
}


output {


#输出到ES中  
  elasticsearch {
#填写ES集群
    hosts => ["http://node-01:9200","http://node-02:9200","http://node-03:9200"]
#ES如果有登陆验证,要配置用户名和密码
#	user => "admin"
#	password => "123456"
#索引名
    index => "test"
#传来的id作为es文档的_id
    document_id => "%{id}"
  }
}

2、官方文档:

https://www.elastic.co/guide/en/logstash/current/plugins-inputs-jdbc.html

3、 对人工智能感兴趣点下面链接

现在人工智能非常火爆,很多朋友都想学,但是一般的教程都是为博硕生准备的,太难看懂了。最近发现了一个非常适合小白入门的教程,不仅通俗易懂而且还很风趣幽默。所以忍不住分享一下给大家。点这里可以跳转到教程。

https://www.cbedai.net/u014646662

发布了139 篇原创文章 · 获赞 273 · 访问量 666万+

猜你喜欢

转载自blog.csdn.net/u014646662/article/details/104938799
今日推荐