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

已打好包的文件下载

链接: https://pan.baidu.com/s/1vY1kx4vTV2xCgkCVaHyEGQ 提取码: f27a 

安装zip文件

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

3、从redis到mysql

input {
    redis {
        key => "content_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"]
    }
}

相关文章:

  • 2022-12-23
  • 2022-02-11
  • 2021-04-24
  • 2022-01-10
  • 2022-12-23
  • 2021-05-07
  • 2021-07-18
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-12
  • 2022-12-23
  • 2021-12-03
  • 2022-12-23
相关资源
相似解决方案