【Kibana6.3.0】Kibana6入門小白教程之下載安裝與資料準備
1. Kibana簡介及下載安裝
Kibana是專門用來為ElasticSearch設計開發的,可以提供資料查詢,資料視覺化等功能。 下載地址為:https://www.elastic.co/downloads/kibana#ga-release,請選擇適合當前es版本的Kibana。 我這裡用的是elasticsearch6.3.0,kibana6.3.0
注意:kibana使用需要安裝JDK和Elasticsearch,安裝教程看我的:Kibana6安裝教程(windows)
2. 資料準備
開啟http://localhost:5601,發現無論是Discover,Visualize還是Dashboard都提示你要新建一個index(索引)
說明Kibana沒有在es中找到合適的index用來展示,如果es中沒有資料,那麼可以匯入官方測試資料,用來學習操作。
如果你的es中已經有可以用來測試的資料,那麼可以略過本節。
官方教程是這樣的:載入示例資料
下面對官方教程進行細節說明(主要是win使用者):
step2: 解壓到自己喜歡的地方,我解壓到D:\mockdata
step3: 在http://localhost:5601的這個地方 分別輸入下面的內容,然後點選右上角的三角形,執行一下
PUT /shakespeare { "mappings": { "doc": { "properties": { "speaker": {"type": "keyword"}, "play_name": {"type": "keyword"}, "line_id": {"type": "integer"}, "speech_number": {"type": "integer"} } } } }
PUT /logstash-2015.05.18
{
"mappings": {
"log": {
"properties": {
"geo": {
"properties": {
"coordinates": {
"type": "geo_point"
}
}
}
}
}
}
}
PUT /logstash-2015.05.19 { "mappings": { "log": { "properties": { "geo": { "properties": { "coordinates": { "type": "geo_point" } } } } } } }
PUT /logstash-2015.05.20
{
"mappings": {
"log": {
"properties": {
"geo": {
"properties": {
"coordinates": {
"type": "geo_point"
}
}
}
}
}
}
}
step4:在任意地方啟動cmd,輸入下面命令
- (前提是安裝了curl)
- 官網給的是單引號,但是單引號在win系統下執行會出錯,改成雙引號就好了。
- 而且這一句-H "Content-Type: application/x-ndjson"
是必須要有的
curl -H "Content-Type: application/x-ndjson" -XPOST "localhost:9200/shakespeare/doc/_bulk?pretty" --data-binary @shakespeare_6.0.json
curl -H "Content-Type: application/x-ndjson" -XPOST "localhost:9200/bank/account/_bulk?pretty" --data-binary @accounts.json
curl -H "Content-Type: application/x-ndjson" -XPOST "localhost:9200/_bulk?pretty" --data-binary @logs.jsonl
step5:在Dev Tools輸入下面命令來驗證是否載入成功
GET /_cat/indices?v
如果顯示類似下面這樣則說明成功了,資料的大小是隨機的
health status index pri rep docs.count docs.deleted store.size pri.store.size
yellow open bank 5 1 1000 0 418.2kb 418.2kb
yellow open shakespeare 5 1 111396 0 17.6mb 17.6mb
yellow open logstash-2015.05.18 5 1 4631 0 15.6mb 15.6mb
yellow open logstash-2015.05.19 5 1 4624 0 15.7mb 15.7mb
yellow open logstash-2015.05.20 5 1 4750 0 16.4mb 16.4mb
- 1
- 2
- 3
- 4
- 5
- 6
在http://localhost:5601的Management
那裡點選Index Patterns
也會看到有資料集的顯示
在index pattern輸入一個已經存在的索引點選下一步然後建立即可