关于服务器:Centos7-安装ELKEFK-7x-集群搭建实战

4次阅读

共计 2780 个字符,预计需要花费 7 分钟才能阅读完成。

环境筹备

  • 点击查看 ELK 对操作系统是否兼容
  • 点击查看 ELK 对 JDK 是否兼容信息列表

尽管官网说 ES 7.12 反对 JDK8, 然而理论测试发现,ES 7.12 开始至多须要 JDK11 以上版本。

  • 因而咱们的服务器最好应用 JDK11 长期反对版本。
Future versions of Elasticsearch will require Java 11; your Java version from [/usr/local/java/jdk/jdk1.8.0_161/jre] does not meet this requirement. Consider switching to a distribution of Elasticsearch with a bundled JDK. If you are already using a distribution with a bundled JDK, ensure the JAVA_HOME environment variable is not set.

ELK 是 Elasticsearch ,Logstash, Kibana 的简称缩写, 次要专一于可视化日志剖析和查问

Elastic Stack 次要包含三大部分:

  • 海量数据存储和检索 —– Elasticsearch 分布式存储和查问
  • 可视化界面和图表生成 —-Kibana 可提供可视化界面和各种图表的生成。
  • 数据采集 —– 能够用 Logstash 采集日志也能够应用 FileBeat 采集日志。

ELK 不过是 Elastic Stack 用法中日志剖析栈的一部分

阐明:

  • 不晓得你们有没有留神到,官网仿佛曾经无意在应用 FileBeat 替换 Logstash 采集日志了。
  • Logstash 是由 Elastic 公司推出的一款开源的服务器端数据处理管道,可能同时从多个起源采集数据,转换数据,而后将数据发送指定的存储库中。Logstash 官网介绍。
  • Filebeat 是 Elastic 公司为解决 Logstash“太重”的问题推出的一款轻量级日志采集器,在解决数量泛滥的服务器、虚拟机和容器生成的日志时可应用 Logstash + Filebeat 的日志采集形式。Filebeat 官网介绍。

装置 ELK/EFK

服务器 IP 主机名 软件列表
10.0.0.11 node-1 Elasticsearch、Kibana、Logstash、FileBeat
10.0.0.12 node-2 Elasticsearch、Logstash、FileBeat
10.0.0.13 node-3 Elasticsearch、Logstash、FileBeat

装置 Elasticsearch

  • Elasticsearch, 江湖人称 ES, 它是一个实时的分布式存储,搜寻和剖析引擎。

下载和解压

  1. ES 的官网下载地址: https://www.elastic.co/cn/dow…
  2. 下载方式二: 应用命令行下载
yum install curl;
curl -L -O https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.12.0-linux-x86_64.tar.gz;
#如果操作系统不反对 curl 命令也能够应用 wget 命令下载
yum install wget
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.12.0-linux-x86_64.tar.gz;
这里应用的版本
elasticsearch-7.16.1-linux-x86_64.tar.gz
filebeat-7.16.1-linux-x86_64.tar.gz
logstash-7.16.2-linux-x86_64.tar.gz
kafka-3.0.0-src.tgz
网盘链接:https://pan.baidu.com/s/1JL_l…
提取码:7777

虚拟机给三台服务器的配置都是

批改操作系统限度

在 Centos7 Linux 操作系统中,默认单个过程能够关上的最多文件数是 1024

然而 ES 对操作系统有些特殊要求

  • 要求操作系统单个过程能够关上的最大文件数起码要达到 65535.
  • 而且 ES 将会应用很多线程, 也须要批改下操作系统限度。
    如果不配置就会报错如下所示:
bootstrap checks failed. You must address the points described in the following [3] lines before starting Elasticsearch.
bootstrap check failure [1] of [3]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65535]
bootstrap check failure [2] of [3]: max number of threads [3687] for user [elasticsearch] is too low, increase to at least [4096]
bootstrap check failure [3] of [3]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

查看以后操作系统反对单个过程能够关上的最多文件数,返回值如果没批改会显示 1024

ulimit -n

要修复 bootstrap check failure [1] of [3] 和 bootstrap check failure [2] of [3]谬误
批改配置文件

vi /etc/security/limits.conf

在最初面退出

*               soft    nofile          65535
*               hard    nofile          65535
*               hard    nproc           4096
*               soft    nproc           4096
  • 设置限度数量,第一列示意用户,* 示意所有用户
  • soft nproc:单个用户可用的最大过程数量(超过会正告);
  • hard nproc:单个用户可用的最大过程数量(超过会报错);
  • soft nofile:可关上的文件描述符的最大数(超过会正告);
  • hard nofile:可关上的文件描述符的最大数 (超过会报错);
    原文链接:https://blog.csdn.net/zxljsbk…
  • 断开 session 链接,从新登陆失效

要修复 bootstrap check failure [3] of [3] 谬误,须要批改 /etc/sysctl.conf

vi /etc/sysctl.conf
# 增加内容
vm.max_map_count=262144
  • vm.max_map_count 配置确保操作系统领有足够多的虚拟内存
  • 如果应用的是包管理器形式装置,那么不须要这个操作,默认会进行配置。
# 刷新配置立刻失效,重启一下
sysctl -p
reboot
正文完
 0