logstash-output-jdbc

1、安装

bin/logstash-plugin install logstash-output-jdbc

安装过程有些慢

2、离线安装

找一个已安装好的环境,将其进行打包

bin/logstash-plugin prepare-offline-pack --output /usr/local/logstash-output-jdbc.zip logstash-output-jdbc

安装zip文件

bin/logstash-plugin install file:///usr/local/logstash-output-jdbc.zip

3、从redis到mysql

input {
    redis {
        key => "complaint_list"
        host => "10.10.0.10"        
        port => 6379
        db => "0"
        data_type => "list"        
    }
}

output {
    jdbc {
        driver_jar_path => "/usr/local/logstash/jdbc-driver-library/mysql-connector-java-8.0.23.jar"
        driver_class => "com.mysql.cj.jdbc.Driver"
        connection_string => "jdbc:mysql://10.10.0.11:3306/base_db?characterEncoding=utf8&autoReconnect=true&serverTimezone=Asia/Shanghai&zeroDateTimeBehavior=convertToNull"
        username => "root"
        password => "123456"
        statement => [ "INSERT INTO t_test_info (id,name) VALUES(?,?)", "id","name"]
    }
}
上一篇:Docker安装elasticsearch和kibana


下一篇:Spring Cloud构建微服务架构:分布式服务跟踪(整合logstash)【Dalston版】