Created
January 29, 2020 09:28
-
-
Save siffash/d78348850a3295af3257b43834400009 to your computer and use it in GitHub Desktop.
Migrate data from MySQL to Elasticsearch using Logstash
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo logstash -e ' | |
input { | |
jdbc { | |
jdbc_driver_class => "com.mysql.jdbc.Driver" | |
jdbc_connection_string => "jdbc:mysql://domain.com:3306/database?autoReconnect=true&useSSL=false&useCursorFetch=true" | |
jdbc_user => "admin" | |
jdbc_password => "password" | |
jdbc_fetch_size => 1000 | |
statement => "SELECT * FROM everything" | |
use_column_value => true | |
tracking_column => "id" | |
lowercase_column_names => false | |
} | |
} | |
output { | |
elasticsearch { | |
document_id => "%{id}" | |
doc_as_upsert => true | |
hosts => ["http://localhost:9200"] | |
index => "tracksy" | |
} | |
} | |
' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Before that:
.jar
files to/usr/local/Cellar/logstash-full/7.4.2/libexec/logstash-core/lib/jars/
(on Mac)