ELK 8.14版本搭建

1.架构图

2.基础环境准备:

        2.1 关闭防火墙和selinux

[root@localhost ~]# setenforce 0
[root@localhost ~]# sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
[root@localhost ~]# cat /etc/selinux/config # This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of three two values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected. 
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted 

        2.2 修改Linux最大打开文件数

[root@localhost ~]# cat /etc/security/limits.conf |grep -v "^#"|grep -v "^$"
*                soft    nproc           65536
*                hard    nproc           65536
*                soft    nofile          65536
*                hard    nofile          65536[root@localhost ~]# cat /etc/sysctl.conf |grep -v "^#"
vm.max_map_count = 655360
[root@localhost ~]# sysctl -p
vm.max_map_count = 655360[root@localhost ~]# cat /etc/systemd/system.conf | grep -v "^#"[Manager]
DefaultLimitNOFILE=655360
DefaultLimitNPROC=655360

        2.3 安装java环境

下载地址:https://www.oracle.com/java/technologies/downloads/#license-lightbox

#1.安装命令
[root@localhost ~]# yum install -y jdk-11.0.24_linux-x64_bin.rpm
已加载插件:product-id, search-disabled-repos, subscription-manager
This system is registered with an entitlement server, but is not receiving updates. You can use subscription-manager to assign subscriptions.
正在检查 jdk-11.0.24_linux-x64_bin.rpm: 2000:jdk-11-11.0.24-7.x86_64
jdk-11.0.24_linux-x64_bin.rpm 将被安装
正在解决依赖关系
--> 正在检查事务
---> 软件包 jdk-11.x86_64.2000.11.0.24-7 将被 安装
--> 解决依赖关系完成依赖关系解决=======================================================================================================================================================================================================================================Package                                          架构                                             版本                                                     源                                                                    大小
=======================================================================================================================================================================================================================================
正在安装:jdk-11                                           x86_64                                           2000:11.0.24-7                                           /jdk-11.0.24_linux-x64_bin                                           270 M事务概要
=======================================================================================================================================================================================================================================
安装  1 软件包总计:270 M
安装大小:270 M
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction正在安装    : 2000:jdk-11-11.0.24-7.x86_64                                                                                                                                                                                       1/1 验证中      : 2000:jdk-11-11.0.24-7.x86_64                                                                                                                                                                                       1/1 已安装:jdk-11.x86_64 2000:11.0.24-7                                                                                                                                                                                                         完毕!#2.查看java版本
[root@localhost ~]# java -version
java version "11.0.24" 2024-07-16 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.24+7-LTS-271)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.24+7-LTS-271, mixed mode)#3.声明环境变量
[root@localhost ~]# export JAVA_HOME=/usr/java/jdk-11-oracle-x64/
[root@localhost ~]# export PATH=$PATH:$JAVA_HOME/bin
[root@localhost ~]# export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
[root@localhost ~]# export LS_JAVA_HOME=/usr/java/jdk-11-oracle-x64/

3.Elasticsearch搭建

        3.1 Elasticsearch认识

        一个开源的分布式搜索引擎,可以用来实现搜索、日志统计、分析、系统监控等功能

        基于倒排索引,优点是根据词条搜索、模糊搜索时,速度非常快,缺点是只能给指定词条创建索引,而不是字段,无法根据字段做排序,关于正向索引和倒排索引会在后面再说明。

        3.2 安装Elasticsearch

#1.解压压缩包
[root@localhost ~]# tar -zxvf elasticsearch-8.14.3-linux-x86_64.tar.gz 
elasticsearch-8.14.3/
elasticsearch-8.14.3/lib/
elasticsearch-8.14.3/lib/elasticsearch-8.14.3.jar
elasticsearch-8.14.3/lib/elasticsearch-preallocate-8.14.3.jar
elasticsearch-8.14.3/lib/elasticsearch-x-content-8.14.3.jar
elasticsearch-8.14.3/lib/elasticsearch-lz4-8.14.3.jar
elasticsearch-8.14.3/lib/elasticsearch-cli-8.14.3.jar
elasticsearch-8.14.3/lib/elasticsearch-vec-8.14.3.jar
elasticsearch-8.14.3/lib/elasticsearch-native-8.14.3.jar
elasticsearch-8.14.3/lib/elasticsearch-core-8.14.3.jar
elasticsearch-8.14.3/lib/elasticsearch-logging-8.14.3.jar
elasticsearch-8.14.3/lib/elasticsearch-secure-sm-8.14.3.jar
...
elasticsearch-8.14.3/logs/
elasticsearch-8.14.3/plugins/
elasticsearch-8.14.3/config/jvm.options.d/#2.拷贝安装目录
[root@localhost ~]# mv elasticsearch-8.14.3 /opt/#3.创建es用户
[root@localhost elasticsearch-8.14.3]# groupadd es
[root@localhost elasticsearch-8.14.3]# useradd es -g es -p es
[root@localhost elasticsearch-8.14.3]# chown -R es:es /opt/elasticsearch-8.14.3/

        3.3 配置Elasticsearch

#1.修改配置文件
[es@localhost config]$ cat elasticsearch.yml|grep -v "^#"|grep -v "^$"
#节点名称
node.name: node-1
#允许所有ip访问
network.host: 0.0.0.0
#端口(默认9200)
http.port: 9200
#日志信息输出目录(按需求修改)
path.data: /datalog/es/data
path.logs: /datalog/es/logs
# 集群发现种子节点列表(集群部署配多个),默认["127.0.0.1"]
discovery.seed_hosts: ["localhost"]
# 手动指定可以成为 mater 的所有节点的 name 或者 ip,这些配置将会在第一次选举中进行计算(可配多>个)
cluster.initial_master_nodes: ["node-1"]
#自动写入的安全配置
#----------------------- BEGIN SECURITY AUTO CONFIGURATION -----------------------# The following settings, TLS certificates, and keys have been automatically      # generated to configure Elasticsearch security features on 16-06-2022 06:41:20# --------------------------------------------------------------------------------# Enable security featuresxpack.security.enabled: truexpack.security.enrollment.enabled: true# Enable encryption for HTTP API client connections, such as Kibana, Logstash, and Agentsxpack.security.http.ssl:enabled: falsekeystore.path: certs/elastic-certificates.p12# Enable encryption and mutual authentication between cluster nodesxpack.security.transport.ssl:enabled: trueverification_mode: certificatekeystore.path: certs/elastic-certificates.p12truststore.path: certs/elastic-certificates.p12#2.生成加密Elasticsearch集群内部通信的自签名证书
[es@localhost bin]$ cd /opt/elasticsearch-8.14.3/bin/
[es@localhost bin]$ ./elasticsearch-certutil ca
This tool assists you in the generation of X.509 certificates and certificate
signing requests for use with SSL/TLS in the Elastic stack.The 'ca' mode generates a new 'certificate authority'
This will create a new X.509 certificate and private key that can be used
to sign certificate when running in 'cert' mode.Use the 'ca-dn' option if you wish to configure the 'distinguished name'
of the certificate authorityBy default the 'ca' mode produces a single PKCS#12 output file which holds:* The CA certificate* The CA's private keyIf you elect to generate PEM format certificates (the -pem option), then the output will
be a zip file containing individual files for the CA certificate and private keyPlease enter the desired output file [elastic-stack-ca.p12]: 
Enter password for elastic-stack-ca.p12 : [es@localhost bin]$ ./elasticsearch-certutil cert --ca elastic-stack-ca.p12
This tool assists you in the generation of X.509 certificates and certificate
signing requests for use with SSL/TLS in the Elastic stack.The 'cert' mode generates X.509 certificate and private keys.* By default, this generates a single certificate and key for useon a single instance.* The '-multiple' option will prompt you to enter details for multipleinstances and will generate a certificate and key for each one* The '-in' option allows for the certificate generation to be automated by describingthe details of each instance in a YAML file* An instance is any piece of the Elastic Stack that requires an SSL certificate.Depending on your configuration, Elasticsearch, Logstash, Kibana, and Beatsmay all require a certificate and private key.* The minimum required value for each instance is a name. This can simply be thehostname, which will be used as the Common Name of the certificate. A fulldistinguished name may also be used.* A filename value may be required for each instance. This is necessary when thename would result in an invalid file or directory name. The name provided hereis used as the directory name (within the zip) and the prefix for the key andcertificate files. The filename is required if you are prompted and the nameis not displayed in the prompt.* IP addresses and DNS names are optional. Multiple values can be specified as acomma separated string. If no IP addresses or DNS names are provided, you maydisable hostname verification in your SSL configuration.* All certificates generated by this tool will be signed by a certificate authority (CA)unless the --self-signed command line option is specified.The tool can automatically generate a new CA for you, or you can provide your own withthe --ca or --ca-cert command line options.By default the 'cert' mode produces a single PKCS#12 output file which holds:* The instance certificate* The private key for the instance certificate* The CA certificateIf you specify any of the following options:* -pem (PEM formatted output)* -multiple (generate multiple certificates)* -in (generate certificates from an input file)
then the output will be be a zip file containing individual certificate/key filesEnter password for CA (elastic-stack-ca.p12) : 
Please enter the desired output file [elastic-certificates.p12]: 
Enter password for elastic-certificates.p12 : Certificates written to /opt/elasticsearch-8.14.3/elastic-certificates.p12This file should be properly secured as it contains the private key for 
your instance.
This file is a self contained file and can be copied and used 'as is'
For each Elastic product that you wish to configure, you should copy
this '.p12' file to the relevant configuration directory
and then follow the SSL configuration instructions in the product guide.For client applications, you may only need to copy the CA certificate and
configure the client to trust this certificate.#3.重置elastic用户密码
[es@localhost elasticsearch-8.14.3]$ cd /opt/elasticsearch-8.14.3/
[es@localhost elasticsearch-8.14.3]$ ./bin/elasticsearch-reset-password -u elastic
This tool will reset the password of the [elastic] user to an autogenerated value.
The password will be printed in the console.
Please confirm that you would like to continue [y/N]yPassword for the [elastic] user successfully reset.
New value: wLpzHs9uTUrjU0iiZy0*

3.4 启动Elasticsearch并测试登录

[es@localhost elasticsearch-8.14.3]$ cd /opt/elasticsearch-8.14.3/
[es@localhost elasticsearch-8.14.3]$ ./bin/elasticsearch -d

        登录输入账号密码:

4.Kibana搭建

        4.1 安装Kibana

#1.解压kibana压缩包
[root@localhost ~]# tar -zxvf kibana-8.14.3-linux-x86_64.tar.gz#2.将解压包移动至/opt目录下
[root@localhost ~]# mv kibana-8.14.3 /opt/#3.对kibana目录进行es授权
[root@localhost ~]# chown -R es:es /opt/kibana-8.14.3/

        4.2 修改Kibana配置文件

#1.切换es用户,修改kibana配置文件
[root@localhost ~]# su es
[es@localhost opt]$ cd /opt/kibana-8.14.3/
[es@localhost kibana-8.14.3]$ cat config/kibana.yml |grep -v "^#"|grep -v "^$"
server.port: 5601
server.host: "11.0.1.17"
elasticsearch.hosts: ["http://11.0.1.17:9200"]
i18n.locale: "zh-CN"
elasticsearch.username: "kibana"
elasticsearch.password: "wLpzHs9uTUrjU0iiZy0*"

        4.3 启动Kibana 

[es@localhost kibana-8.14.3]$ ./bin/kibana

5.logstash搭建

        5.1 logstash安装

#1.解压logstash包并拷贝到/opt目录
[root@localhost ~]# tar -zxvf logstash-8.14.3-linux-x86_64.tar.gz
[root@localhost ~]# mv logstash-8.14.3 /opt/
[root@localhost ~]# chown -R es:es /opt/logstash-8.14.3/

        5.2 logstash配置

        

[root@localhost ~]# su es
[es@localhost kibana-8.14.3]$ cd /opt/logstash-8.14.3/
[es@localhost logstash-8.14.3]$ cat config/logstash.conf 
input {syslog {type => "system-syslog"port => "5044"}
}
output {elasticsearch {hosts => ["https://11.0.1.17:9200"]index => "system-syslog-%{+YYYY.MM}"user => "elastic"password => "wLpzHs9uTUrjU0iiZy0*"# cacert => "/opt/logstash-8.14.3/certs/elastic-certificates.p12"}
}

然后用./bin/logstash -f config/logstash.conf启动即可

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://xiahunao.cn/news/3249714.html

如若内容造成侵权/违法违规/事实不符,请联系瞎胡闹网进行投诉反馈,一经查实,立即删除!

相关文章

手机恢复回收站清空的照片,3个方法与注意事项【小米/华为/vivo】

你们是否曾遭遇过这样的困境:清空回收站后,突然发现其中有几张非常重要的照片?那种懊悔与焦虑,简直可以写成一部“手机用户的心酸史”。这篇文章来拯救你啦!恢复回收站清空的照片的方法可不少,究竟是哪3个方…

uni-app开发日志:unicloud使用时遇到的问题解决汇总(不断补充)

插件安装后提示与原数据库表冲突(2024.7.18) 安装uni-admin后再安装uni-cms,在uni-admin中添加好菜单,结果提示该错误 回到hbuilder中uniCloud/database中找到冲突的部分 比较一下,选中老的删除 opendb-news-articl…

【转盘案例-弹框-修改Bug-完成 Objective-C语言】

一、我们来看示例程序啊 1.旋转完了以后,它会弹一个框,这个框,是啥, Alert 啊,AlertView 也行, AlertView,跟大家说过,是吧,演示过的啊,然后,我们就用iOS9来做了啊,完成了以后,我们要去弹一个框, // 弹框 UIAlertController *alertController = [UIAlertContr…

maven项目打成可运行的jar及pom中的依赖一同打包

maven项目打jar及pom中的依赖一同打包 最近开发中有个需求,不部署新的服务,只jar包执行 那maven项目中,代码如何以jar的方式运行、如何把代码打成jar、pom中的依赖如何与代码一同打到jar包中? 1、代码如何以jar的方式运行&…

222.买卖股票的最佳时机(力扣)

代码解决 class Solution { public:int maxProfit(vector<int>& prices) {// 初始化最小买入价为第一个价格int min1 prices[0];// 初始化最大利润为0int max1 0;// 从第二天开始遍历价格数组for (int i 1; i < prices.size(); i) {// 计算当前价卖出的利润&a…

FastAPI 学习之路(五十九)封装统一的json返回处理工具

在本篇文章之前的接口&#xff0c;我们每个接口异常返回的数据格式都不一样&#xff0c;处理起来也没有那么方便&#xff0c;因此我们可以封装一个统一的json。 from fastapi import status from fastapi.responses import JSONResponse, Response from typing import Unionde…

SSM 整合(Spring + MyBatis;Spring + Spring MVC)

1. SSM 整合(Spring MyBatis&#xff1b;Spring Spring MVC) 文章目录 1. SSM 整合(Spring MyBatis&#xff1b;Spring Spring MVC)2. 引入相关依赖3. SSM 整合3.1 创建包结构 4. Spring 整合 MyBatis4.1 编写 jdbc.properties4.2 编写 DataSourceConfig 数据源配置4.3 编…

【LLM】基于ColossalAI-0.3.6对llama2-7B-Chat做全参数微调

文章目录 环境准备工作下载llama2-7B下载ColossalAI数据集准备准备原始数据集数据集处理开始训练准备训练脚本运行脚本推理验证加载模型推理环境 操作系统: ubuntu22.04机器规格: CPU:96c;内存:736 GiB;GPU:8 * NVIDIA V100 (32GB)软件信息: Python 3.11.5;ColossalA…

vue 实现打字机效果

打字机效果组件&#xff0c;支持像打字机一样模仿键入文本。支持vue 插值语法和表格等打印 ps: 灵感来着于vue-type-writer 但是 这个组件过于简单 就自己整了一个 一、预览 二、代码 组件&#xff1a; <template><div :style"{ visibility: visibility }&qu…

Flink History Server配置

目录 问题复现 History Server配置 HADOOP_CLASSPATH配置 History Server配置 问题修复 启动flink集群 启动Histroty Server 问题复现 在bigdata111上执行如下命令开启socket&#xff1a; nc -lk 9999 如图&#xff1a; 在bigdata111上执行如下命令运行flink应用程序 …

stm32入门-----EXTI外部中断(下——实践篇)

目录 前言 一、硬件介绍 1.对射红外线传感器 2.旋转编码器 二、EXTI外部中断C编程 1.开启RCC时钟 2.配置GPIOK口初始化 3.配置AFIO 4.配置EXIT 5.配置NVIC 三、EXIT外部中断项目实操 1.对射红外传感器计数 2.选择编码器计数 前言 本期接着上一期的内容继续学习stm3…

什么是正则表达式,如何在 Python 中使用?

什么是正则表达式 正则表达式&#xff08;Regular Expression&#xff0c;简称Regex&#xff09;是一种用于匹配字符串中字符模式的工具。它是由普通字符&#xff08;例如字母、数字&#xff09;以及一些特殊字符&#xff08;称为元字符&#xff09;组成的字符序列。这种模式用…

DDei在线设计器-HTML渲染

Html渲染 HtmlViewer插件通过将一个外部DIV附着在图形控件上&#xff0c;从而改变原有图形的显示方式。允许使用者自己定义HTML通过HTML元素。本示例演示了通过Html来扩展渲染图形&#xff0c;从而获得更加丰富的图形展现。 通常情况下&#xff0c;我们创建的图形控件&#xff…

PHP基础语法(一)

一、初步语法 1、PHP代码标记&#xff1a;以 <?php 开始&#xff0c;以 ?> 结束&#xff1b; 2、PHP注释&#xff1a;行注释&#xff1a;//&#xff08;双斜杠&#xff09;或# 块注释&#xff1a;/* */ 3、PHP语句分隔符&#xff1a; 1&#xff09;在PHP中&#…

机器人及其相关工科专业课程体系

机器人及其相关工科专业课程体系 前言传统工科专业机械工程自动化/控制工程计算机科学与技术 新兴工科专业智能制造人工智能机器人工程 总结Reference: 前言 机器人工程专业是一个多领域交叉的前沿学科&#xff0c;涉及自然科学、工程技术、社会科学、人文科学等相关学科的理论…

C++:类和对象 III(初始化列表、explicit、友元、匿名对象)

目录 初始化列表 初始化列表的特点 类型转换、explicit 隐式类型转换 explicit关键字 static成员 静态成员变量 静态成员函数 友元 友元函数 友元类 内部类 匿名对象 编译器优化 初始化列表 初始化列表就是类成员初始化的地方 函数有它声明和定义的地方&#x…

xFormers - Transformers 加速研究的工具箱

文章目录 一、关于 xFormers特点 二、安装xFormers三、Benchmarks&#xff08;可选&#xff09;测试安装 四、使用xFormers1、Transformers 关键概念2、Repo map3、主要特点4、安装故障排除 一、关于 xFormers xFormers是一个基于PyTorch的库&#xff0c;其中包含灵活的Transf…

Java_MyBatisPlus

MyBatisPlus属于是MyBatis的拓展&#xff0c;不影响原MyBatis框架下的代码运行&#xff0c;并对MyBatis框架进行拓展及优化。 使用步骤&#xff1a; 注意&#xff1a;继承BaseMapper时要填写泛型为要操作的实体类。 基本原理&#xff1a; MyBatisPlus通过扫描实体类&#xff…

adb查看网卡信息,并修改网卡mac地址

这种方法修改mac后&#xff0c;关机后会失效! 文章结尾有永久修改mac地址的方法! 1. 查看网卡的信息&#xff0c;以及mac地址&#xff0c;ip地址&#xff0c;子网掩码等 //查看所有网卡信息adb shell ifconfig//MAC地址&#xff1a; HWaddr 5e:2c:e9:58:3e:4f //IP地址&a…

安全防御拓扑2

实验拓扑&#xff1a;​​​​​​​ 要求&#xff1a; 1、办公区设备可以通过电信链路和移动链路上网(多对多的NAT&#xff0c;并且需要保留一个公网IP不能用来转换) 2、分公司设备可以通过总公司的移动链路和电信链路访问到Dmz区的http服务器 3、多出口环境基于带宽比例进行…