說明:本文為Windows環境下的相關安裝示例,適用於需要用Logstash和Logstash-input-jdbc將數據從數據庫導入到Elasticsearch中的場景。
一、前置條件
電腦上安裝有JDK8或者以上版本,安裝有ElasticSearch,並啟動。
二、安裝並驗證Logstash
1.軟件下載
官網地址:https://www.elastic.co/cn/downloads/past-releases/#logstash
2.下載后直接解壓即可使用
3.啟動並驗證
打開cmd命令行,進入dos窗口,切換到logstash安裝路徑下的bin目錄,執行以下命令:
logstash -e "input { stdin { } } output { stdout {} }"
正常可以看到如圖打印啟動成功的信息:
可以輸入測試內容,如“hello world” 進一步驗證。
三、安裝logstash-input-jdbc插件
【新版本logstash下自帶logstash-input-jdbc,故不需要安裝logstash-input-jdbc】
CMD命令行切換到bin目錄,執行以下命令安裝Logstash-input-jdbc插件:
logstash-plugin install logstash-input-jdbc
安裝正常的話,將打印成功信息:
安裝失敗:報錯:
Validating logstash-input-jdbc
Errno::EIO: Input/output error - C:\Users\??У??\.gem
報錯解決方案: