Elastic Stack
是由ELK演进来的,ELK是指elasticsearch+logstash+kibana,后来在发展过程中,又加入了新成员Beats,所以形成了Elastic Stack。
这整个Elastic Stack之间的成员之间的大致关系是:
通过Beats采集数据,经过logstash进行数据处理后存入elasticsearch,然后交由kibana进行展示
Elasticsearch
elasticsearch是Elastic Stack的核心。
官网:Elasticsearch:官方分布式搜索和分析引擎 | Elastic
Elasticsearch 是一个分布式、RESTful 风格的搜索和数据分析引擎,能够解决不断涌现出的各种用例。 作为 Elastic Stack 的核心,它集中存储您的数据,帮助您发现意料之中以及意料之外的情况。
单机版安装
我们在linux上安装
1、下载:Download Elasticsearch | Elastic
2、创建用户
#Elasticaearch不支持root用户运行,所以要先创建用户
useradd es
#指定es用户的密码
passwd es
3、创建elasticsearch文件目录,并修改文件目录的所有者为es用户
/opt/soft/elasticsearch/es
4、上传安装包,解压到指定目录
5、修改配置文件
配置访问ip:
#设置ip为0.0.0.0,可以使用任意网络访问
network.host: 0.0.0.0
修改启动参数
vim jvm.options
#修改以下参数
-Xms128m
-Xmx128m
使用root用户,配置进程创建内存映射最大数量
vim /etc/sysctl.conf
#新增配置项
vm.max_map_count=655360
#保存退出后,使用以下命令使其生效
sysctl -p
6、启动elasticsearch
目录:/opt/soft/elasticsearch/es/elasticsearch-8.2.3/bin
#启动elasticsearch
./elasticsearch
启动时有报错信息: [1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65535]
解决办法:需要使用root用户,编辑/etc/security/limits.conf
vim /etc/security/limits.conf
#添加以下配置
* soft nofile 65536
* hard nofile 131072
* soft nproc 2048
* hard nproc 4096
#报错信息
exception during geoip databases update
#解决办法
elasticsearch.yml增加配置 ingest.geoip.downloader.enabled: false
如果使用的环境是centos6的话,可能还会出现其他错误
#报错信息
max number of threads [1024] for user [es] is too low,increase to at least[4096]
#解决 使用root用户
vi etc/security/limits.d/xx-nproc.conf
#修改* soft nproc
* sfot nproc 4096
#报错信息
system call filter failed to install;check the logs and fix your configuuration or disable system call filters at your own risk
#解决办法
vim config/elasticsearch.yml
#添加以下配置项
bootstrap.system_call_filter:false
7、验证
可以看到后台es已经启动了
我们在前台启动的日志信息中可以看到,es绑定了9200的端口:
我们可以通过ip:9200访问测试
访问出现 报错信息:
修改 xpack.security.enabled: false
xpack.security.http.ssl:
enabled: false
#报错信息
[2022-06-21T14:50:02,837][WARN ][o.e.x.s.t.n.SecurityNetty4HttpServerTransport] [localhost.localdomain] received plaintext http traffic on an https channel, closing connection Netty4HttpChannel{localAddress=/192.168.253.130:9200, remoteAddress=/192.168.253.1:19443}
#修改
xpack.security.enabled: false
xpack.security.enrollment.enabled: true
# Enable encryption for HTTP API client connections, such as Kibana, Logstash, and Agents
xpack.security.http.ssl:
enabled: false
keystore.path: certs/http.p12
然后重新访问:成功
一般情况下,我们都使用后台启动方式启动es
./elasticsearch -d
8、停止es:kill pid