#ELK 搭建
[TOC]
##⚠️
请保持全程elk各系统间的版本一致
elk的数据增长很快,请在开始的时候注意切分好index,方便清理旧数据
本文档仅适用于参考,不同的服务器,版本等信息均需要参看官方教程一切以官网文档为第一手资料
##安装:
###filebean
####下载
####安装
####配置
####软链
###logstash:
####java环境依赖
export JAVACMD=`which java` export JAVA_HOME=`which java`
####下载
####软链:
warning: logstash-5.1.1.rpm: Header V4 RSA/SHA512 Signature, key ID d88e42b4: NOKEY
####插件:
plugin 接收插件,gem_source 墙
/usr/share/logstash/Gemfilefilebeat
1 /usr/share/logstash/bin/logstash-plugin install logstash-input-beats
#####start bug fix/usr/bin/filebeat.sh -e -c /data/local/filebeat/filebeat.yml
##启动
###filebean
####测试
|
|
####生产
####清空
测试数据复用
1 rm /usr/share/filebeat/bin/data/registry
###logstash
####测试
####生产
@(工具)
###elasticsearch:
####概览:
- Check your cluster, node, and index health, status, and statistics
- Administer your cluster, node, and index data and metadata
- Perform CRUD (Create, Read, Update, and Delete) and search operations against your indexes
- Execute advanced search operations such as paging, sorting, filtering, scripting, aggregations, and many others
####下载
####启动
####测试
helath check
list of node
index of node :
create index :
让我们将一个简单的客户文档索引到客户索引“外部”类型,ID为1,如下所示:
新增=修改
1234 curl -XPUT 'localhost:9200/customer/external/1?pretty&pretty' -d'{"name": "John Doe"}'查看
12 curl -XGET 'localhost:9200/customer/external/1?pretty&pretty'curl -XGET 'localhost:9200/customer/external/1?pretty'删除
1 curl -XDELETE 'localhost:9200/customer?pretty'
del index
list index
elastic_search
本轮存在很大问题啊
1234567 curl -XPUT 'localhost:9200/customer?pretty'curl -XPUT 'localhost:9200/customer/external/2?pretty' -d'{"name": "John"}'curl -XGET 'localhost:9200/customer/external/1?pretty'curl -XDELETE 'localhost:9200/customer?pretty'
that in the above case, we are using the POST verb instead of PUT since we didn’t specify an ID.
自增
修改1
修改2
修改 put可以直接进行创建的时候修改
####批量操作目前测试不通过,只有批量的第一个会成功
####实际数据操作
准备数据
查询 REST request URI
查询 REST request body
查询扩展 REST request body size 默认 10
####elastic search 扩展练习
|
|
###kibana
####安装
vi /etc/yum.repos.d/kibana.repo
|
|
####运行
sudo -i service kibana start
####配置
nginx转发
####elastic search生产环境部署bug fix:
#####Q1:ERROR: bootstrap checks failed
system call filters failed to install; check the logs and fix your configuration or disable system call filters at your own risk
#####Q2:max file descriptors [4096] for elasticsearch process likely too low, increase to at least [65536]
#####Q3max number of threads [1024] for user [lishang] likely too low, increase to at least [2048]
###x-pack
x-pack 是需要license的,请安装的时候注意,如果不准备申请license的话:
配置如下:elasticsearch.yml
1234 xpack.security.enabled: falsexpack.monitoring.enabled: truexpack.graph.enabled: false#xpack.reporting.enabled: false
|
|
####安装
elasticsearch
kibana
logstash
filebeat
####设置
#####密码
#####访问控制
######创建角色
######创建管理员
#####修改密码
参考链接:
filebeat安装文档教程
filebeat配置文档教程
logstash安装文档教程
logstash安装插件教程
logstash配置文档教程