loki、promtail、Grafana安裝包
鏈接:https://pan.baidu.com/s/1vkSa_KYrXM0UEI8i42KdaA
提取碼:4d4q
如果安裝失敗或者下載速度慢可以直接去官網下載
------------------------------------------------------
loki官網 https://github.com/grafana/loki/releases/
配置文件官網 https://grafana.com/docs/loki/latest/installation/local/
配置文件下載
wget https://raw.githubusercontent.com/grafana/loki/master/cmd/loki/loki-local-config.yaml
wget https://raw.githubusercontent.com/grafana/loki/master/cmd/promtail/promtail-local-config.yaml
------------------------------------------------------
grafana 下載
wget https://dl.grafana.com/oss/release/grafana-7.2.0-1.x86_64.rpm
sudo yum install grafana-7.2.0-1.x86_64.rpm
grafana 下載官網 https://grafana.com/grafana/download
------------------------------------------------------
下載完之后解壓
執行命令 單個執行
./loki-linux-amd64 -config.file=./etc/loki-local-config.yaml
./promtail-linux-amd64 -config.file=./etc/promtail-local-config.yaml
./grafana-server web
后台執行命令為
nohup ./loki-linux-amd64 -config.file=./etc/loki-local-config.yaml & nohup ./promtail-linux-amd64 -config.file=./etc/promtail-local-config.yaml & nohup ./grafana-7.1.1/bin/grafana-server web &
grafana訪問為 http://localhost:3000
如果訪問失敗,很大概率是grafana啟動失敗
這個時候可以查看端口號是否開啟 netstat -anp | grep 3000
如果沒有,則進入到 ./grafana-7.1.1/bin/
執行 ./grafana-server web
執行成功進入到grafana登錄頁面。
默認賬號密碼都是admin
首次進入會提示修改密碼。看清楚輸入框。
創建一個data sources
這里填寫的是loki的鏈接,這個鏈接可以訪問,正常是返回數據,但有時候也可能返回404。目前沒發現影響使用的地方
保存成功的提示是兩個綠色的彈窗success
然后直接去查看explore
選擇log label
log label就是promtail-local-config.yaml配置文件里面的scraoe_configs里面的的labels
如果這里不出現的原因可能有2個:
1.grafana訪問promtail的端口鏈接超時,目前沒發現解決辦法。
2.__path__路徑錯了。可以通過訪問localhost:9080 查看
localhost:9080頁面
如果配置成如下。就表示成功了
相對來說比ELK簡單很多。下載三個文件,修改下配置就可以直接跑通。個人感覺loki的重點應該是分布式日志的獲取
loki是日志處理
promtail是收集日志
grafana是UI頁面