【ES系列】(一)简介与安装

本文涉及的产品
检索分析服务 Elasticsearch 版,2核4GB开发者规格 1个月
简介: 【ES系列】(一)简介与安装


首发博客地址

首发博客地址[1]

系列文章地址[2]

教学视频[3]


为什么要学习 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 可以提供开发全文搜索引擎的技能和经验,为职业发展增添竞争力。

总结起来大概就是:

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

官网

官网地址[4]

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[5]

安装虚拟机

如果你是本地练习,可以参考这篇文章安装 Linux 系统环境: https://blog.zysicyj.top/4e7b516e[6]

环境兼容性检查

这里一定要确认好 jdk 版本,比如 8.8 支持 jdk19,8.9 不支持 jdk19,但是所有 8.x 都是支持 17 的,因为 17 是 LTS 版本。

所以建议大家安装 jdk17,兼容性比较高

兼容性检查[7]

准备安装包

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

关注【程序员朱永胜】回复【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"
}

参考资料

[1]

首发博客地址: https://blog.zysicyj.top/

[2]

系列文章地址: https://blog.zysicyj.top/categories/技术文章/后端技术/系列文章/ES/

[3]

教学视频: https://www.ixigua.com/7273889957465293368?logTag=89ff41ffd92c090eb176

[4]

官网地址: https://www.elastic.co/cn/

[5]

【ChatGPT】Elasticsearch插件:将ChatGPT引入Elasticsearch: https://www.elastic.co/cn/blog/chatgpt-elasticsearch-plugin-elastic-data

[6]

https://blog.zysicyj.top/4e7b516e:https://blog.zysicyj.top/4e7b516e

[7]

兼容性检查: https://www.elastic.co/cn/support/matrix#matrix_jvm&#enterprise-search-and-jvm

[8]

https://www.elastic.co/cn/downloads/elasticsearch:https://www.elastic.co/cn/downloads/elasticsearch

本文由 mdnice 多平台发布


相关实践学习
使用阿里云Elasticsearch体验信息检索加速
通过创建登录阿里云Elasticsearch集群,使用DataWorks将MySQL数据同步至Elasticsearch,体验多条件检索效果,简单展示数据同步和信息检索加速的过程和操作。
ElasticSearch 入门精讲
ElasticSearch是一个开源的、基于Lucene的、分布式、高扩展、高实时的搜索与数据分析引擎。根据DB-Engines的排名显示,Elasticsearch是最受欢迎的企业搜索引擎,其次是Apache Solr(也是基于Lucene)。 ElasticSearch的实现原理主要分为以下几个步骤: 用户将数据提交到Elastic Search 数据库中 通过分词控制器去将对应的语句分词,将其权重和分词结果一并存入数据 当用户搜索数据时候,再根据权重将结果排名、打分 将返回结果呈现给用户 Elasticsearch可以用于搜索各种文档。它提供可扩展的搜索,具有接近实时的搜索,并支持多租户。
相关文章
|
3月前
|
JavaScript 前端开发 Java
ES6 简介
ES6 简介
|
3月前
|
JavaScript 前端开发
|
4月前
|
数据可视化 开发工具 git
ES入门以及安装
ES入门以及安装
33 0
|
10月前
|
Docker 容器
es应用笔记1-es部署
es应用笔记1-es部署
81 0
|
JavaScript 前端开发 编译器
ES6 从入门到精通 # 01:ES6 介绍
ES6 从入门到精通 # 01:ES6 介绍
87 0
ES6 从入门到精通 # 01:ES6 介绍
|
安全 Go
ES6入门之let、cont
ES6入门之let、cont
|
Web App开发 运维 安全
ES 8.x 系列教程:ES 8.0 服务安装(可能是最详细的ES 8教程)
ES 8.x 系列教程:ES 8.0 服务安装(可能是最详细的ES 8教程)
ES 8.x 系列教程:ES 8.0 服务安装(可能是最详细的ES 8教程)
|
Java 关系型数据库 数据库
ES入门
ES入门
150 0
|
存储 JSON 搜索推荐
ES 简介|学习笔记
快速学习 ES 简介。
96 0
ES 简介|学习笔记
|
Java Linux 数据安全/隐私保护
ES 安装及配置介绍|学习笔记
快速学习 ES 安装及配置介绍。
99 0

热门文章

最新文章

相关实验场景

更多