es同步mysql同步
Posted double_yuan
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了es同步mysql同步相关的知识,希望对你有一定的参考价值。
1.下载es
https://www.elastic.co/downloads/elasticsearch
修改 config 下elasticsearch.yml ip和端口等配置
2.下载kibana
https://www.elastic.co/downloads/kibana
修改 config 下kibana.yml ip和端口es等配置
3.下载logstash
https://www.elastic.co/downloads/logstash
下载jar mysql-connector-java-5.1.47.jar
config下添加文件jdbc.conf
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.1mysql-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:FullTextlogstash-6.3.2configjdbc.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目录下
执行命令 logstash.bat -f ..configjdbc.conf
6.启动 kibana 测试es连接
以上是关于es同步mysql同步的主要内容,如果未能解决你的问题,请参考以下文章