ElasticSearch官网
https://www.elastic.co/cn/
Window安装ElasticSearch
1.安装ElasticSearch(下载elasticsearch-7.3.2.msi)
2.安装Node.js(下载node-v12.11.1-x64.msi)
3.安装grunt(npm install -g grunt-cli)
4.安装Head插件(ES5以上版本安装head需要安装node和grunt,之前的直接用plugin命令即可安装)
a.修改elasticsearch.yml文件,添加如下内容,并重启ES服务
http.cors.enabled: true
http.cors.allow-origin: "*"
b.下载head压缩包并解压:https://github.com/mobz/elasticsearch-head
c.修改D:\ElasticSearch\elasticsearch-head-master\Gruntfile.js,在port:9100上一行加入hostname: ‘*‘,
d.在D:\ElasticSearch\elasticsearch-head-master目录下,npm install(安装)、grunt server(启动)
Head地址
http://localhost:9100
ES地址
http://localhost:9200
window安装logstash
1.下载并解压
2.复制mysql-connector-java-5.1.44.jar到bin目录
3.在bin目录下新建logstash-es.conf文件,内容如下
input {
stdin { }
jdbc {
jdbc_driver_library => "mysql-connector-java-5.1.44.jar"
jdbc_driver_class => "com.mysql.jdbc.Driver"
jdbc_connection_string => "jdbc:mysql://localhost:3306/sb"
jdbc_user => "root"
jdbc_password => "root"
jdbc_paging_enabled => "true"
jdbc_page_size => "50000"
record_last_run => true
use_column_value => true
tracking_column => "create_time"
last_run_metadata_path => "./last.txt"
clean_run => "false"
statement => "SELECT * FROM sys_operator where create_time > :sql_last_value"
schedule => "* * * * *"
}
}
output {
elasticsearch {
hosts => "localhost:9200"
index => "sb"
document_type => "sys_operator"
document_id => "%{operator_id}"
}
}
4.进入bin目录下,执行logstash.bat -f logstash-es.conf
原文:https://www.cnblogs.com/lc19149/p/11690403.html