logstash5.5.0同步sql server数据
注意:jdbc.conf和jdbc.sql文件编码都为ANSI
jdbc.conf内容如下:
input { stdin { } jdbc { jdbc_connection_string => "jdbc:sqlserver://172.19.148.63:1433;databaseName=EB_Search" jdbc_user => "sa" jdbc_password => "123@abcd" jdbc_driver_library => "D:\Software\ELK5.5.0\logstash-5.5.0\bin\mssql\sqljdbc4-2.0.jar" jdbc_driver_class => "com.microsoft.sqlserver.jdbc.SQLServerDriver" statement_filepath => "D:\Software\ELK5.5.0\logstash-5.5.0\bin\mssql\jdbc.sql" schedule => "* * * * *" } } output { elasticsearch { hosts => "10.0.10.143:9200" index => "sync_productinfo" } }
jdbc.sql内容如下:
SELECT TOP 1000 * FROM [ProductInfo] ORDER BY CreateTime DESC
启动命令:
cd D:\Software\ELK5.5.0\logstash-5.5.0\bin .\logstash.bat -f .\mssql\jdbc.conf
我的网站 http://www.a-du.net