1.下載esjava
https://www.elastic.co/downloads/elasticsearchmysql
修改 config 下elasticsearch.yml ip和端口等配置sql
2.下載kibanajson
https://www.elastic.co/downloads/kibanaapp
修改 config 下kibana.yml ip和端口es等配置elasticsearch
3.下載logstash測試
https://www.elastic.co/downloads/logstashui
下載jar mysql-connector-java-5.1.47.jarspa
config下添加文件jdbc.confcode
input {
stdin {
}
jdbc {
# mysql jdbc connection string to our backup databse
jdbc_connection_string => "jdbc:mysql://localhost:3306/testguize"
# the user we wish to excute our statement as
jdbc_user => "chai"
jdbc_password => "chai"
# the path to our downloaded jdbc driver
jdbc_driver_library => "E:\elasticsearch6.1\mysql-connector-java-5.1.26.jar"
# the name of the driver class for mysql
jdbc_driver_class => "com.mysql.jdbc.Driver"
jdbc_paging_enabled => "true"
jdbc_page_size => "50000"
statement => "select * from user"
# statement_filepath => "F:\FullText\logstash-6.3.2\config\jdbc.sql"
schedule => "* * * * *"
type => "lxuser"
}
}
filter {
json {
source => "message"
remove_field => ["message"]
}
}
output {
elasticsearch {
hosts => "192.168.0.61:9200"
# port => "9200"
# protocol => "http"
index => "mysql"
document_id => "%{id}"
# cluster => "fulltext-application"
}
stdout {
codec => json_lines
}
}
4.啓動es
elasticsearch 下載目錄bin目錄下elasticsearch.bat
5. logstash bin目錄下