ElasticSearch入门教程--集群搭建和版本比较

这篇具有很好参考价值的文章主要介绍了ElasticSearch入门教程--集群搭建和版本比较。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

一、ElasticSearch 集群

Elasticsearch 集群有一个唯一的名字,默认就是”elasticsearch”。,一个节点只能通过指定某个集群的名字,来加入这个集群。
elasticsearch版本比较,elasticsearch,ES集群,SpringBoot集成ES

集群搭建如下:

  1. 复制ES的安装目录三份:esnode-1,esnode-2,esnode-3,分别编辑config/elasticsearch.yml 配置文件

node-1:

# ======================== 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
#
# ---------------------------------- Cluster -----------------------------------
#
# Use a descriptive name for your cluster:
#
cluster.name: my-elasticsearch
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#
node.name: node-1
node.master: true
node.data: true 
#
# 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: /path/to/data
#
# Path to log files:
#
#path.logs: /path/to/logs
#
# ----------------------------------- 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 -----------------------------------
#
# Set the bind address to a specific IP (IPv4 or IPv6):
#
network.host: localhost
#
# Set a custom port for HTTP:
#
http.port: 1001
#tcp 监听端口
transport.tcp.port: 9301



#discovery.seed_hosts: ["localhost:9201", "localhost:9301", "localhost:9401"]
#discovery.zen.fd.ping_timeout: 1m
#discovery.zen.fd.ping_retries: 5
#
# Bootstrap the cluster using an initial set of master-eligible nodes:
#
#cluster.initial_master_nodes: ["node-1", "node-2", "node-3"]

#
# 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: ["localhost:9301", "localhost:9401"]
#discovery.zen.fd.ping_timeout: 1m
#discovery.zen.fd.ping_retries: 5
#
# Bootstrap the cluster using an initial set of master-eligible nodes:
#
#cluster.initial_master_nodes: ["node-1", "node-2", "node-3"]
#
# For more information, consult the discovery and cluster formation module documentation.
#
# ---------------------------------- Gateway -----------------------------------
#
# Block initial recovery after a full cluster restart until N nodes are started:
#
#gateway.recover_after_nodes: 3
#
# For more information, consult the gateway module documentation.
#
# ---------------------------------- Various -----------------------------------
#
# Require explicit names when deleting indices:
#
#action.destructive_requires_name: true

#跨域配置

http.cors.enabled: true
http.cors.allow-origin: "*"

node-2:

# ======================== 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
#
# ---------------------------------- Cluster -----------------------------------
#
# Use a descriptive name for your cluster:
#
cluster.name: my-elasticsearch
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#
node.name: node-2
node.master: true
node.data: true
#
# 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: /path/to/data
#
# Path to log files:
#
#path.logs: /path/to/logs
#
# ----------------------------------- 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 -----------------------------------
#
# Set the bind address to a specific IP (IPv4 or IPv6):
#
network.host: localhost
#
# Set a custom port for HTTP:
#
http.port: 1002
transport.tcp.port: 9302


#
# 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: ["localhost:9301"]
discovery.zen.fd.ping_timeout: 1m
discovery.zen.fd.ping_retries: 5

#
# Bootstrap the cluster using an initial set of master-eligible nodes:
#
#cluster.initial_master_nodes: ["node-1", "node-2", "node-3"]
#
# For more information, consult the discovery and cluster formation module documentation.
#
# ---------------------------------- Gateway -----------------------------------
#
# Block initial recovery after a full cluster restart until N nodes are started:
#
#gateway.recover_after_nodes: 3
#
# For more information, consult the gateway module documentation.
#
# ---------------------------------- Various -----------------------------------
#
# Require explicit names when deleting indices:
#
#跨域配置
#action.destructive_requires_name: true
http.cors.enabled: true
http.cors.allow-origin: "*"

node-3:

# ======================== 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
#
# ---------------------------------- Cluster -----------------------------------
#
# Use a descriptive name for your cluster:
#
cluster.name: my-elasticsearch
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#
node.name: node-3
node.master: true
node.data: true
#
# 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: /path/to/data
#
# Path to log files:
#
#path.logs: /path/to/logs
#
# ----------------------------------- 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 -----------------------------------
#
# Set the bind address to a specific IP (IPv4 or IPv6):
#
network.host: localhost
#
# Set a custom port for HTTP:
#
http.port: 1003
transport.tcp.port: 9303
#
# 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: ["localhost:9302", "localhost:9301"]
discovery.zen.fd.ping_timeout: 1m
discovery.zen.fd.ping_retries: 5
#
# Bootstrap the cluster using an initial set of master-eligible nodes:
#
#cluster.initial_master_nodes: ["node-1", "node-2", "node-3"]
#
# For more information, consult the discovery and cluster formation module documentation.
#
# ---------------------------------- Gateway -----------------------------------
#
# Block initial recovery after a full cluster restart until N nodes are started:
#
#gateway.recover_after_nodes: 3
#
# For more information, consult the gateway module documentation.
#
# ---------------------------------- Various -----------------------------------
#
# Require explicit names when deleting indices:
#
#跨域配置
#action.destructive_requires_name: true
http.cors.enabled: true
http.cors.allow-origin: "*"

2、分别启动,浏览器访问http://localhost:1001/_cluster/healthhttp://localhost:1002/_cluster/healthhttp://localhost:1003/_cluster/health,集群启动成功。

elasticsearch版本比较,elasticsearch,ES集群,SpringBoot集成ES
搭建成功后,可以将请求发送到集群中的任何节点 ,包括主节点。 每个节点都知道文档所处的位置,并且能够将我们的请求直接转发到存储我们所需文档的节点。 无论我们将请求发送到哪个节点,它都能负责从各个包含我们所需文档的节点收集回数据,并将最终结果返回給客户端。 Elasticsearch 对这一切的管理都是透明的。

二、Elasticsearch的核心概念

2.1、分片(Shards)

一个索引可以存储超出单个节点硬件限制的大量数据。比如,一个具有 10 亿文档数据的索引占据 1TB 的磁盘空间,而任一节点都可能没有这样大的磁盘空间。或者单个节点处理搜索请求,响应太慢。为了解决这个问题,Elasticsearch 提供了将索引划分成多份的能力,每一份就称之为分片。当你创建一个索引的时候,你可以指定你想要的分片的数量。每个分片本身也是一个功能完善并且独立的“索引”,这个“索引”可以被放置到集群中的任何节点上。

分片很重要,主要有两方面的原因:
1)允许水平分割 / 扩展内容容量。
2)允许在分片之上进行分布式的、并行的操作,进而提高性能/吞吐量。

当 Elasticsearch 在索引中搜索的时候, 他发送查询到每一个属于索引的分片(Lucene 索引),然后合并每个分片的结果到一个全局的结果集。

2.2、副本(Replicas)

Elasticsearch 允许你创建分片的一份或多份拷贝,这些拷贝叫做复制分片(副本)。

复制分片之所以重要,有两个主要原因:

提供了高可用性。复制分片从不与原分片置于同一节点上是非常重要的。

扩展搜索量/吞吐量,因为搜索可以在所有的副本上并行运行。当拥有越多的副本分片时,也将拥有越高的吞吐量。

每个索引可以被分成多个分片。一经复制,每个索引就有了主分片(作为复制源的原来的分片)和复制分片(主分片的拷贝)之别。分片和复制的数量可以在索引创建的时候指定。在索引创建之后,你可以在任何时候动态地改变复制的数量,但是不能改变分片的数量

默认情况下,Elasticsearch 中的每个索引被分片 1 个主分片和 1 个复制,根据索引需要确定分片个数。

2.3、路由计算

Elasticsearch 如何知道一个文档应该存放到哪个分片中呢?当我们创建文档时,它如何决定这个文档应当被存储在分片1 还是分片 2 中呢?

这个过程是根据下面这个公式决定的:

shard = hash(routing) % number of primary_shards

routing 是一个可变值,默认是文档的 _id ,也可以设置成一个自定义的值。 routing 通过hash 函数生成一个数字,然后这个数字再除以 number_of_primary_shards (主分片的数量)后得到的余数 就是文档所在分片的位置。

2.4、倒排索引

Elasticsearch 使用一种倒排索引的结构,适用于快速的全文搜索。

我们经常了解的是正向索引(forward index),所谓正向索引,就是搜索引擎会将待搜索的文件都对应一个文件 ID,搜索时将这个ID 和搜索关键字进行对应,形成 K-V 对,然后对关键字进行统计计数,常见Mysql中的表结构。

倒排索引,搜索引擎会将正向索引重新构建为倒排索引,即把文件ID对应到关键词的映射转换为关键词到文件ID的映射,每个关键词都对应着一系列的文件,这些文件中都出现这个关键词。

三、Kibana简介

Kibana 是一个免费且开放的用户界面,能够让你对 Elasticsearch 数据进行可视化,并让你在 Elastic Stack 中进行导航。你可以进行各种操作,从跟踪查询负载,到理解请求如何流经你的整个应用,都能轻松完成。

下载地址:点击下载windows版本

修改 config/kibana.yml 文件

server.port: 5601
server.host: "127.0.0.1"
elasticsearch.hosts: ["http://127.0.0.1:9200"]
kibana.index: ".kibana"
i18n.locale: "zh-CN"

运行行 bin/kibana.bat ,浏览器访问 http://localhost:5601

elasticsearch版本比较,elasticsearch,ES集群,SpringBoot集成ES

四、Spring Data ElasticSearch

Spring Data Elasticsearch 基于 spring data API 简化 Elasticsearch 操作,将原始操作Elasticsearch 的客户端 API 进行封装 。

Spring Data 为 Elasticsearch 项目提供集成搜索引擎。

elasticsearch版本比较,elasticsearch,ES集群,SpringBoot集成ES

官方网站: 点击进入

集成步骤:
1、新建Maven项目。POM文件添加依赖:

 <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-elasticsearch</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <scope>runtime</scope>
            <optional>true</optional>
        </dependency>

        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-test</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-test</artifactId>
            <version>5.2.13.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
        </dependency>
    </dependencies>

2、application.yml 配置:

# es 服务地址
elasticsearch:
  host: localhost
  port: 9200

3、Entity类:

package com.swc.es.entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.util.Date;


@Data
@AllArgsConstructor
@NoArgsConstructor
@ToString
@Document(indexName = "user", shards = 3, replicas = 1)
public class User {

    @Id
    private Long id;

    private String name;

    @Field(index = false)
    private String sex;

    private int age;

    private String address;

    private Date birth;

}

4、增加配置类,读取配置信息

ElasticsearchRestTemplate 是基于 RestHighLevelClient 客户端的。只要自定义配置类,继承AbstractElasticsearchConfiguration,并实现 elasticsearchClient()抽象方法,创建 RestHighLevelClient 对
象。

public class ElasticSearchConfig extends AbstractElasticsearchConfiguration {

    @Value("elasticsearch.host")
    private String host ;

    @Value("elasticsearch.port")
    private Integer port ;

    @Override
    public RestHighLevelClient elasticsearchClient() {
        RestClientBuilder builder = RestClient.builder(new HttpHost(host, port));
        RestHighLevelClient restHighLevelClient = new
                RestHighLevelClient(builder);
        return restHighLevelClient;
    }
}

5、DAO 数据访问对象

@Repository
public interface UserDao extends ElasticsearchRepository<User, Long> {
}

6、测试:

索引测试:

@RunWith(SpringRunner.class)
@SpringBootTest
public class SpringDataESTest {


    //注入 ElasticsearchRestTemplate
    @Autowired
    private ElasticsearchRestTemplate elasticsearchRestTemplate;


    @Autowired
    private UserDao userDao;



    @Test
    public void createIndex(){
        //
        System.out.println("创建索引,系统初始化会自动创建索引");
    }

    @Test
    public void deleteIndex(){
        //创建索引,系统初始化会自动创建索引
        boolean flg = elasticsearchRestTemplate.deleteIndex(User.class);
        System.out.println("删除索引 = " + flg);
    }

}

文档查询测试:文章来源地址https://www.toymoban.com/news/detail-603943.html

package com.swc.es.controller;

import com.swc.es.dao.UserDao;
import com.swc.es.entity.User;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.index.query.TermQueryBuilder;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.test.context.junit4.SpringRunner;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;


@RunWith(SpringRunner.class)
@SpringBootTest
public class SpringDataESUserDaoTest {

    @Autowired
    private UserDao userDao;
    /**
     * 新增
     */
    @Test
    public void save(){
        User user = new User();
        user.setId(1L);
        user.setName("张三");
        user.setAge(25);
        user.setBirth(new Date());
        user.setAddress("北京市丰台区");
        userDao.save(user);
    }
    //修改
    @Test
    public void update(){
        User user = new User();
        user.setId(5L);
        user.setName("张三大哥");
        user.setSex("男");
        user.setAge(25);
        user.setBirth(new Date());
        user.setAddress("北京市丰台区");
        userDao.save(user);
    }
    //根据 id 查询
    @Test
    public void findById(){
        User user = userDao.findById(5L).get();
        System.out.println(user);
    }
    //查询所有
    @Test
    public void findAll(){
        Iterable<User> Users = userDao.findAll();
        for (User user : Users) {
            System.out.println(user);
        }
    }
    //删除
    @Test
    public void delete(){
        User user = new User();
        user.setId(1L);
        userDao.delete(user);
    }
    //批量新增
    @Test
    public void saveAll(){
        List<User> userList = new ArrayList<>();
        for (int i = 2; i < 10; i++) {
            User user = new User();
            user.setId(Long.valueOf(i));
            user.setName("张三大哥");
            user.setAge(25+i);
            user.setBirth(new Date());
            user.setAddress("北京市丰台区"+i+"号院");
            userList.add(user);
        }
        userDao.saveAll(userList);
    }
    //分页查询
    @Test
    public void findByPageable(){
        //设置排序(排序方式,正序还是倒序,排序的 id)
        Sort sort = Sort.by(Sort.Direction.DESC,"id");
        int currentPage=0;//当前页,第一页从 0 开始,1 表示第二页
        int pageSize = 5;//每页显示多少条
        //设置查询分页
        PageRequest pageRequest = PageRequest.of(currentPage, pageSize,sort);
        //分页查询
        Page<User> UserPage = userDao.findAll(pageRequest);
        for (User user : UserPage.getContent()) {
            System.out.println(user);
        }
    }


    /**
     * term 查询
     * search(termQueryBuilder) 调用搜索方法,参数查询构建器对象
     */
    @Test
    public void termQuery(){
        TermQueryBuilder termQueryBuilder = QueryBuilders.termQuery("name", "张三");
                Iterable<User> users = userDao.search(termQueryBuilder);
        for (User user : users) {
            System.out.println(user);
        }
    }
    /**
     * term 查询加分页
     */
    @Test
    public void termQueryByPage(){
        int currentPage= 0 ;
        int pageSize = 3;
        //设置查询分页
        PageRequest pageRequest = PageRequest.of(currentPage, pageSize);
        TermQueryBuilder termQueryBuilder = QueryBuilders.termQuery("name", "张三");
        Iterable<User> users = userDao.search(termQueryBuilder,pageRequest);
        for (User user : users) {
            System.out.println(user);
        }
    }
}

到了这里,关于ElasticSearch入门教程--集群搭建和版本比较的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • 超详细Redis入门教程——Redis 主从集群(下)

    本文小新为大家带来 Redis 主从集群 相关知识,具体内容包括 哨兵机制实现 (包括: 哨兵机制简介 , Redis 高可用集群搭建 , Redis 高可用集群的启动 , Sentinel 优化配置 ), 哨兵机制原理 (包括: 三个定时任务 , Redis 节点下线判断 , Sentinel Leader 选举 , master 选择算法

    2024年02月07日
    浏览(41)
  • Elasticsearch入门使用教程 _1

    目录 1.初识elasticsearch 1.1.了解ES 1.1.1.elasticsearch的作用 1.1.2.ELK技术栈 1.1.3.elasticsearch和lucene 1.1.4.为什么不是其他搜索技术? 1.1.5.总结 1.2.倒排索引 1.2.1.正向索引 1.2.2.倒排索引 1.2.3.正向和倒排 1.3.es的一些概念 1.3.1.文档和字段 1.3.2.索引和映射 1.3.3.mysql与elasticsearch 1.4.安装es、

    2024年02月03日
    浏览(31)
  • Elasticsearch 入门教程 – bool 过滤器

    在了解之前,先来理解filter与query不同: Query与Filter     查询在Query查询上下文和Filter过滤器上下文中,执行的操作是不一样的: 查询上下文:      在查询上下文中,查询会回答这个问题——“这个文档匹不匹配这个查询,它的相关度高么?”       如何验证匹配很好理解

    2024年04月28日
    浏览(23)
  • Git快速入门篇—— Windows版本淘宝镜像快速下载安装详细步骤及简单入门教程(附带图文教程)

    前言:我们平时在整理代码的时候,尤其是与别人一起开发项目的时候,常常涉及到代码的更新,因此代码版本问题成了一个很头痛的事。而git正是为了解决这种问题而诞生。本文将详细介绍如何通过淘宝镜像进行git的安装以及git的简单入门技巧。 下一章: git与远程仓库的交

    2024年02月03日
    浏览(74)
  • Git入门实战教程之创建版本库

    Git是一个分布式版本控制系,分层结构如下: Git分为四层: 当前正在工作的项目的实际文件目录,我们执行命令git init时所在的地方,也就是我们执行一切文件操作的地方。 暂存区是一个介于工作目录和本地仓库之间的缓冲区域。它保存了已经通过git add命令添加但尚未通过

    2024年04月11日
    浏览(33)
  • Linux安装Elasticsearch(手把手入门教程及下载资源)

    介绍Elasticsearch: 分布式,无需人工搭建集群(solr就需要人为配置,使用Zookeeper作为注册中心) Restful风格,一切API都遵循Rest原则,容易上手 近实时搜索,数据更新在Elasticsearch中几乎是完全同步的 官网地址 点击进入官网点击去体验 下拉找到该模块点击下载 选择系统类型,点

    2023年04月08日
    浏览(34)
  • Elasticsearch教程—Elasticsearch Java API Client [8.6]开发入门(官方原版)

    大家好,我是Doker! Java 8 或更高版本。 一个 JSON 对象映射库,允许无缝集成 您的应用程序类与 Elasticsearch API 一起。Java 客户端具有 支持 Jackson 或 Eclipse Yasson 等 JSON-B 库。 Java API客户端由三个主要组件组成: API客户端类。这些为Elasticsearch API提供了强类型的数据结构和方法。

    2024年02月13日
    浏览(28)
  • 552、Elasticsearch详细入门教程系列 -【分布式全文搜索引擎 Elasticsearch(三)】 2023.05.19

    1.1 简单介绍 之前是对ES中的创建/查看/删除索引、创建定义映射、创建/查看/修改/删除文档的这些操作有了一定的了解认识,但是是通过Postman + JSON串的方法来实现的 那么之后仍然是对ES中的索引、映射、文档进行操作,只是方法换成了Java API。 1.2 案例详情 首先需要创建一个

    2024年02月08日
    浏览(41)
  • 551、Elasticsearch详细入门教程系列 -【分布式全文搜索引擎 Elasticsearch(二)】 2023.04.04

    1.1 Elasticsearch中的数据格式 Elasticsearch 是面向文档型数据库,一条数据在这里就是一个文档。为了方便大家理解,我们将 Elasticsearch 里存储文档数据和关系型数据库 MySQL 存储数据的概念进行一个类比。 ES 里的 Index 可以看做一个库,而 Types 相当于表,Documents 则相当于表的行。

    2023年04月11日
    浏览(71)
  • ElasticSearch集群8.0版本搭建、故障转移

           ELasticsearch的集群是由多个节点组成的,通过cluster.name设置集群名称,并且用于区分其它的集群,每个节点通过node.name指定节点的名称。 在Elasticsearch中,节点的类型主要有4种: master节点 配置文件中node.master属性为true(默认为true),就有资格被选为master节点。master节

    2024年02月11日
    浏览(26)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包