1.logstash導入腳本:
loginfo.conf
input {
jdbc {
jdbc_connection_string => "jdbc:mysql://127.0.0.1:3306/commondb"
jdbc_user => "root"
jdbc_password => "123456"
jdbc_driver_library => "/data/logstash/mysql-connector-java-5.1.46.jar"
jdbc_driver_class => "com.mysql.jdbc.Driver"
jdbc_paging_enabled => "true"
jdbc_page_size => "50000"
statement_filepath => "/data/logstash/test.sql"
lowercase_column_names => false
# schedule => "* * * * *"
type => "loginfo"
}
}
output {
if[type] == "loginfo"{
elasticsearch {
hosts => "127.0.0.1:9200"
index => "loginfo"
document_type => "info"
document_id => "%{id}"
}
}
# 控制檯輸出內容
stdout {
codec => json_lines
}
}
執行./bin/logstash -f loginfo.conf;
ES出現:
解決辦法:
修改創建之後索引副本數量:
curl -X PUT "http://localhost:9200/loginfo/_settings?pretty" -H 'Content-Type: application/json' -d '{"index":{"number_of_replicas":0}}'