体验:刚开始探索,做一个简单搭建。ES几乎不需要配置,filebeat的配置比较友好,kibana需要探索一番。 在业务系统中对接口输入输出写好日志,关键词搜索速度很快,对问题排查定位非常有用。
为什么不是ELK:听说filebeat对IO消耗小
注意
- 安装速度很慢。后半夜安装或找合适的资源或下载安装包方式。
- elasticsearch不能以root用户启动
一、安装EFK
-
ubuntu:
apt install elasticsearch
&& (cd /usr/share/elasticsearch
&&./bin/elasticsearch -d
)
apt install kibana
&&service kibana start
apt install filebeat
&&service filebeat start
-
mac
brew install elasticsearch
&&brew services start elasticsearch
brew install kibana
&&brew services start kibana
brew install filebeat
&&brew services start filebeat
查看
ps -ef | grep elasticsearch
或者查看端口号lsof -i:9200
,kibana是5601
端口。
二、配置
因系统默认版本不同,所以kibana界面有些改变。例如我的mac的ES是6.8,ubuntu是7+.
-
配置filebeat
vim /usr/local/etc/filebeat/filebeat.yml
filebeat.prospectors: - type: log enabled: true # 开启 paths: #读取文件,注意得是该配置不会递归目录 - /var/log/php/*.log
重启filebeat.
进入侧边栏
Discover
,即可查看到配置的数据。
三、开启模块
- 打开kibana界面
http://localhost:5601/
(ubuntu自己配置代理对外访问)
选择想要添加的模块。并按照文档设置。Dashboard
预定义了很多模块的展示图,可以添加看看。
四、没写完。
安装ik
cd {elasticsearch目录}
&& ./elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v7.8.1/elasticsearch-analysis-ik-7.8.1.zip
根据es版本选择ik版本,==========