Synchronizing SQL Server data to Elasticsearch with LOGSTASH-INPUT-JDBC

Source: Internet
Author: User
Tags logstash

Here I am demonstrating the operation under Windows

First download logstash-5.6.1, directly to the official website to download

1. You need to create the following jdbc.conf and myes.sql two files

input {stdin {} jdbc {jdbc_driver_library="D:\jdbcconfig\sqljdbc4-4.0.jar"Jdbc_driver_class="Com.microsoft.sqlserver.jdbc.SQLServerDriver"jdbc_connection_string="jdbc:sqlserver://127.0.0.1:1433;databasename=abtest"Jdbc_user="SA"Jdbc_password="123456"# Schedule=Timeshare Month Year # Schedule= * A*  *  *//Would execute at 22:00 every daySchedule ="* * * * *"jdbc_paging_enabled=truejdbc_page_size= +Clean_run=falseUse_column_value=true
#设置查询条件的字段 Tracking_column=lastedittime Record_last_run=trueLast_run_metadata_path="D:\jdbcconfig\data\station_parameter.txt"
#设置列名小写 lowercase_column_names=trueStatement_filepath="/jdbcconfig/myes.sql"#索引的类型 Type="Test"}}filter {json {source="message"Remove_field= ["message"]}}output {elasticsearch {hosts= ["172.16.57.233:9200"] Action="Index"#索引 Index="Test"document_id="%{productid}"} stdout {#codec=Json_lines
#设置输出的格式 codec=Line {format="ProductID:%{[productid]} isdeleted:%{[isdeleted]} lastedittime:%{[lastedittime]}" } }}
It is important to note that the configured path is correct and no execution will error

Myes.sql is the SQL statement inside where you need to execute the query


SELECT *
From [Dbo].test

The first thing to do is start Elasticsearch,

Then execute the following command in the bin directory of the Logstash: Logstash-f jdbcconfig/jdbc.conf

The data will begin to sync ....

Synchronizing SQL Server data to Elasticsearch with LOGSTASH-INPUT-JDBC

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.