window下部署ELK(6.2.2系列)

介紹

ELK = ElasticSearch + Logstash + Kibana前端

在ELK棧裏依賴關係node

  1. Kibana 依賴 Elasticsearch
  2. Logstash 數據 輸出到 Elasticsearch
  3. Elasticsearch 數據來源 依賴 Logstash

因此咱們如下按照依賴順序安裝相應的服務: ElasticSearch -> Logstash -> Kibanalinux

elastic官網git

安裝目錄結構

X:\ELK
X:\Elasticsearch
X:\Kibana
X:\Logstash

本教程的X如下是用D盤代替

ElasticSearch

下載 elasticsearch-6.2.2

# wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.2.2.zip
# 自行下載 wget是linux命令
解壓到D:\ElasticSearch\elasticsearch-6.2.2

bin目錄結構

clipboard.png

安裝

cd D:\ElasticSearch\elasticsearch-6.2.2\bin
elasticsearch-service.bat install
# 提示:The service 'elasticsearch-service-x64' has been installed.表示安裝成功

# install:安裝服務|remove:刪除服務|start:啓動|stop:暫停|manager:打開服務管理器
elasticsearch-service.bat install|remove|start|stop|manager

web查看服務

http://localhost:9200
clipboard.png

head插件 (不是必須,可跳過,kibana裏也有個dev_tool可調試查詢)

head插件是一個es集羣的web前端工具,咱們能夠es查詢,查看es集羣狀態等github

# es 6.2.2版本es自帶 須要獨立安裝
安裝nodejs
下載https://github.com/coreybutler/nvm-windows 安裝
nvm install v8.9.4
# npm加速 全局安裝cnpm 指定來源淘寶鏡像
npm install -g cnpm --registry=https://registry.npm.taobao.org
git clone git://github.com/mobz/elasticsearch-head.git
cd elasticsearch-head
cnpm install
npm run start
open http://localhost:9100/

#其餘版本es能夠按如下命令安裝
elasticsearch-plugin.bat install mobz/elasticsearch-head

# 修改elasticksearch配置 (config/elasticsearch.yml) 添加一下配置
http.cors.enabled: true
http.cors.allow-origin: "*"

elasticsearch-service.bat stop
elasticsearch-service.bat start


open http://localhost:9100/

clipboard.png

Logstash

下載 logstash-6.2.2

# wget https://artifacts.elastic.co/downloads/logstash/logstash-6.2.2.zip
解壓到D:\Logstash\logstash-6.2.2

無需安裝,直接使用

# logstash -e '配置文件內容'
# logstash -f 配置文件

測試demo

# conf/test.conf
input {
    file {
        path => "D:/elk/Elasticsearch/elasticsearch-6.2.2/logs/*.*"
        start_position => "beginning"
    }
}

output {
    elasticsearch {
        
        hosts => ["localhost:9200"]
    }
}

測試

logstash -f conf/test.conf

clipboard.png

Kibana

下載 kibana-6.2.2

# wget https://artifacts.elastic.co/downloads/kibana/kibana-6.2.2-windows-x86_64.zip
解壓到D:\Logstash\kibana-6.2.2

運行

cd bin
kibanna.bat

open http://localhost:5601

配置開機運行

elasticsearch 已是註冊成服務, 咱們還須要把logstash和kibana註冊成服務web

下載工具nssm

# https://nssm.cc/download
wget https://nssm.cc/release/nssm-2.24.zip
vim start.bat
logstash -f conf/test.conf

註冊配置

clipboard.png

clipboard.png

clipboard.png

clipboard.png

相關文章
相關標籤/搜索