关于后端:ES系列一简介与安装

8次阅读

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

首发博客地址

首发博客地址

系列文章地址


为什么要学习 ES?

  1. 弱小的全文搜寻和检索性能 :Elasticsearch 是一个开源的分布式搜寻和剖析引擎,应用倒排索引和分布式计算等技术,提供了弱小的全文搜寻和检索性能。学习 ES 能够把握如何构建简单的查问、应用各种过滤器和聚合操作来优化搜寻后果。
  2. 实时数据分析和解决 :ES 反对实时数据的索引和查问,可用于解决大规模的实时数据。学习 ES 能够理解如何应用 ES 进行实时数据的剖析和解决,包含日志剖析、事件处理、实时监控等。
  3. 分布式存储和扩展性 :ES 是一个分布式系统,能够将数据分布在多个节点上,以进步存储容量和查问性能。学习 ES 能够帮忙理解如何搭建和治理分布式 ES 集群,以及如何优化集群的性能和可靠性。
  4. 文档导入和解决 :ES 反对各种数据源的导入和解决,包含数据库、文件、API 等。学习 ES 能够把握如何将不同数据源的数据导入到 ES 中,并进行相应的解决和转换。
  5. 日志剖析和搜索引擎优化 :ES 在日志剖析和搜索引擎优化方面有很大的利用价值。学习 ES 能够学会如何利用 ES 进行日志的实时剖析和搜寻,以及如何优化搜索引擎的性能和相关性。
  6. 全文搜索引擎的开发和利用 :ES 是一个十分风行的全文搜索引擎,许多企业和我的项目都在应用 ES 构建全文搜寻性能。学习 ES 能够提供开发全文搜索引擎的技能和教训,为职业倒退削减竞争力。

总结起来大略就是:

  • 分布式搜索引擎
  • 大数据实时剖析引擎

官网

官网地址

ES 倒退历史

Elasticsearch (ES) 的倒退历史能够追溯到 2004 年,过后 Shay Banon 创立了一个名为 Compass 的开源我的项目,作为一个基于 Lucene 的全文搜索引擎库。

随着工夫的推移,Compass 逐步倒退成为一个独立的搜索引擎,但在 2009 年,Shay Banon 决定从新设计和重构该我的项目,以解决一些困扰他的设计和架构问题。于是,他创立了一个新的我的项目,命名为 ”elasticsearch”,并于 2010 年开源公布。

以下是 ES 的次要倒退里程碑:

  • 2010 年 :Elasticsearch 首次开源公布。它基于 Apache Lucene 构建,提供了一个分布式搜寻和剖析引擎,用于实时数据的索引和查问。
  • 2013 年 :Elasticsearch 正式成为 Elastic 公司的外围产品,并开始受到宽泛关注和采纳。此时,Elasticsearch 曾经成为开源搜索引擎的领导者之一。
  • 2014 年 :Elasticsearch 公布了 1.0 版本,这是一个重要的里程碑,标记着 ES 的稳定性和成熟度。1.0 版本引入了一些重要的个性和改良,如聚合操作和索引别名等。
  • 2015 年 :Elasticsearch 公布了 2.0 版本,引入了许多重要的性能和改良,包含复合索引、文档级别的更新和删除、分布式索引排序等。
  • 2016 年 :Elasticsearch 公布了 5.0 版本,这是一个重要的版本公布,引入了许多重大的改良和变动。5.0 版本引入了新的分布式文档存储形式,并且废除了一些旧的性能和 API。
  • 2019 年 :Elasticsearch 公布了 7.0 版本,这是一个重要的版本公布,引入了许多重要的性能和改良。7.0 版本引入了 Elasticsearch 的新分布式协调引擎,称为 ”Zen 2″,以进步集群的稳定性和性能。
  • 2022 年 :Elasticsearch 公布了 8.0 版本,这是一个重要的版本公布,引入了许多重要的性能和改良。原生反对 NLP,速度、扩大和检索相关性晋升,通过原生矢量搜寻进步搜寻相关性,默认开启平安性能

随着工夫的推移,Elasticsearch 一直发展壮大,成为一个功能强大、可靠性高的分布式搜寻和剖析引擎。它被广泛应用于各种场景,包含日志剖析、实时数据处理、全文搜寻和商业智能等。并且,Elastic 公司也推出了其余产品,如 Kibana、Logstash 和 Beats 等,构建了一个残缺的数据分析和可视化平台,被称为 ”Elastic Stack” 或 ”ELK Stack”。

去官网上瞄了一眼,还反对 GPT 了.. 牛逼,大略看了文章说的是,通过插件能够拜访 ES 内容,厉害了,有趣味能够点击上面链接看看:

【ChatGPT】Elasticsearch 插件:将 ChatGPT 引入 Elasticsearch

装置虚拟机

如果你是本地练习,能够参考这篇文章装置 Linux 零碎环境:https://blog.zysicyj.top/4e7b516e

环境兼容性查看

这里肯定要确认好 jdk 版本,比方 8.8 反对 jdk19,8.9 不反对 jdk19,然而所有 8.x 都是反对 17 的,因为 17 是 LTS 版本。

所以倡议大家装置 jdk17,兼容性比拟高

兼容性查看

筹备安装包

官网下载:https://www.elastic.co/cn/downloads/elasticsearch

关注【程序员朱永胜】回复【1021】不限速下载

装置 es

yum install elasticsearch-8.9.1-x86_64.rpm

systemctl daemon-reload
systemctl enable elasticsearch.service

批改配置文件

# ======================== Elasticsearch Configuration =========================
#
# NOTE: Elasticsearch comes with reasonable defaults for most settings.
#       Before you set out to tweak and tune the configuration, make sure you
#       understand what are you trying to accomplish and the consequences.
#
# The primary way of configuring a node is via this file. This template lists
# the most important settings you may want to configure for a production cluster.
#
# Please consult the documentation for further information on configuration options:
# [https://www.elastic.co/guide/en/elasticsearch/reference/index.html](https://www.elastic.co/guide/en/elasticsearch/reference/index.html "https://www.elastic.co/guide/en/elasticsearch/reference/index.html")
#
# ---------------------------------- Cluster -----------------------------------
#
# Use a descriptive name for your cluster:
#
cluster.name: my-application
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#
node.name: node-1
#
# Add custom attributes to the node:
#
#node.attr.rack: r1
#
# ----------------------------------- Paths ------------------------------------
#
# Path to directory where to store the data (separate multiple locations by comma):
#
path.data: /var/lib/elasticsearch
#
# Path to log files:
#
path.logs: /var/log/elasticsearch
#
# ----------------------------------- Memory -----------------------------------
#
# Lock the memory on startup:
#
#bootstrap.memory_lock: true
#
# Make sure that the heap size is set to about half the memory available
# on the system and that the owner of the process is allowed to use this
# limit.
#
# Elasticsearch performs poorly when the system is swapping the memory.
#
# ---------------------------------- Network -----------------------------------
#
# By default Elasticsearch is only accessible on localhost. Set a different
# address here to expose this node on the network:
#
network.host: 0.0.0.0
#
# By default Elasticsearch listens for HTTP traffic on the first free port it
# finds starting at 9200. Set a specific HTTP port here:
#
http.port: 9200
#
# For more information, consult the network module documentation.
#
# --------------------------------- Discovery ----------------------------------
#
# Pass an initial list of hosts to perform discovery when this node is started:
# The default list of hosts is ["127.0.0.1", "[::1]"]
#
#discovery.seed_hosts: ["host1", "host2"]
#
# Bootstrap the cluster using an initial set of master-eligible nodes:
#
#cluster.initial_master_nodes: ["node-1", "node-2"]
#
# For more information, consult the discovery and cluster formation module documentation.
#
# ---------------------------------- Various -----------------------------------
#
# Allow wildcard deletion of indices:
#
#action.destructive_requires_name: false

#----------------------- BEGIN SECURITY AUTO CONFIGURATION -----------------------
#
# The following settings, TLS certificates, and keys have been automatically
# generated to configure Elasticsearch security features on 31-08-2023 09:48:01
#
# --------------------------------------------------------------------------------

# Enable security features
xpack.security.enabled: false
xpack.ml.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

# Enable encryption and mutual authentication between cluster nodes
xpack.security.transport.ssl:
  enabled: false
  verification_mode: certificate
  keystore.path: certs/transport.p12
  truststore.path: certs/transport.p12
# Create a new cluster with the current node only
# Additional nodes can still join the cluster later
cluster.initial_master_nodes: ["localhost.localdomain"]

# Allow HTTP API connections from anywhere
# Connections are encrypted and require user authentication
http.host: 0.0.0.0

# Allow other nodes to join the cluster from anywhere
# Connections are encrypted and mutually authenticated
#transport.host: 0.0.0.0

#----------------------- END SECURITY AUTO CONFIGURATION -------------------------

启动并校验 es

systemctl start elasticsearch
systemctl status elasticsearch

呈现这个画面根本是没问题了

[root@localhost elasticsearch]# curl -X GET "http://localhost:9200/"
{
  "name" : "node-1",
  "cluster_name" : "my-application",
  "cluster_uuid" : "XAGRLef2SayyXzuNHPgX2Q",
  "version" : {
    "number" : "8.9.1",
    "build_flavor" : "default",
    "build_type" : "rpm",
    "build_hash" : "a813d015ef1826148d9d389bd1c0d781c6e349f0",
    "build_date" : "2023-08-10T05:02:32.517455352Z",
    "build_snapshot" : false,
    "lucene_version" : "9.7.0",
    "minimum_wire_compatibility_version" : "7.17.0",
    "minimum_index_compatibility_version" : "7.0.0"
  },
  "tagline" : "You Know, for Search"
}

本文由 mdnice 多平台公布

正文完
 0