springboot引入Elasticsearch

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

之前在工程中日志信息存储在Mysql中,由于日志越来越大,导致查询效率越来越慢,想着运用Elasticsearch提高效率,自己结合情况,花了半天时间写了一套springboot引用Elasticsearch。

一 :创建SpringBoot项目并引入Elasticsearch依赖

引入相关jar包,具体如下(注意与springboot版本相对应):

        <dependency>
            <groupId>org.elasticsearch</groupId>
            <artifactId>elasticsearch</artifactId>
            <version>7.17.9</version>
        </dependency>
        <dependency>
            <groupId>org.elasticsearch.client</groupId>
            <artifactId>transport</artifactId>
            <version>7.17.9</version>
        </dependency>

        <dependency>
            <groupId>org.elasticsearch.client</groupId>
            <artifactId>elasticsearch-rest-high-level-client</artifactId>
            <version>7.17.9</version>
        </dependency>

二 :SpringBoot项目配置相应配置信息

配置相应的Elasticsearch,具体如下:

spring:
  elasticsearch:
    host: 127.0.0.1
    port: 9200
    connTimeout: 3000
    socketTimeout: 5000
    connectionRequestTimeout: 500

三 :SpringBoot项目配置相应配置客户端

配置读取配置的类:

import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Data
@Component
public class EsConfig {

    @Value("${spring.elasticsearch.host}")
    private String host;

    @Value("${spring.elasticsearch.port}")
    private int port;

    @Value("${spring.elasticsearch.connTimeout}")
    private int connTimeout;

    @Value("${spring.elasticsearch.socketTimeout}")
    private int socketTimeout;

    @Value("${spring.elasticsearch.connectionRequestTimeout}")
    private int connectionRequestTimeout;

}

创建连接Elasticsearch连接的客户端:

import com.huanggr.common.core.domain.EsConfig;
import lombok.extern.slf4j.Slf4j;
import org.apache.http.HttpHost;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestClientBuilder;
import org.elasticsearch.client.RestHighLevelClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

@Slf4j
@Configuration
@Component
public class ElasticsearchConfiguration {
    @Autowired
    EsConfig esConfig;


    @Bean(destroyMethod = "close", name = "client")
    public RestHighLevelClient initRestClient() {
        RestClientBuilder builder = RestClient.builder(new HttpHost(esConfig.getHost(), esConfig.getPort()))
                .setRequestConfigCallback(requestConfigBuilder -> requestConfigBuilder
                        .setConnectTimeout(esConfig.getConnTimeout())
                        .setSocketTimeout(esConfig.getSocketTimeout())
                        .setConnectionRequestTimeout(esConfig.getConnectionRequestTimeout()));
        return new RestHighLevelClient(builder);
    }

    // 注册 rest高级客户端
    @Bean
    public RestHighLevelClient restHighLevelClient() {
        RestHighLevelClient client = new RestHighLevelClient(
                RestClient.builder(
                        new HttpHost(esConfig.getHost(), esConfig.getPort(), "http")
                )
        );
        return client;
    }

}

四 :配置相应的Elasticsearch的操作类

配置相应的枚举:


/**
 * Es查询类型
 *
 * @author huanggr
 */

public enum EsQueryType
{
    term("term", "精确值查找"),
    range("range", "范围检索"),
    prefix("prefix", "模糊查询");

    public  String code;
    public  String value;

    EsQueryType(String code, String value)
    {
        this.code = code;
        this.value = value;
    }

    public String getCode()
    {
        return code;
    }

    public String getValue()
    {
        return value;
    }
}

public enum RangeType {

    lte("lte","小于或等于"),
    lt("lt","小于"),
    gt("gt","大于"),
    gte("gte","大于或等于");

    private final String code;
    private final String value;

    RangeType(String code, String value)
    {
        this.code = code;
        this.value = value;
    }

    public String getCode()
    {
        return code;
    }

    public String getValue()
    {
        return value;
    }
}

配置相应的实体类:

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

@Data
public class EsQueryVo {
    @ApiModelProperty(value = "参数主键")
    private String name;

    @ApiModelProperty(value = "参数主键值")
    private String value;

    @ApiModelProperty(value = "查询类型")
    private String queryType;

    @ApiModelProperty(value = "大于或者大于等于或者小于或者等于")
    private String gteandlte;

    public EsQueryVo(){

    }
    public EsQueryVo(String name, String value,String queryType,String gteandlte){
        this.name = name;
        this.value = value;
        this.queryType = queryType;
        this.gteandlte = gteandlte;
    }

}
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
import java.util.Map;

@Data
public class PageList {
    @ApiModelProperty(value = "集合")
    private List<Map<String,Object>> hitList;

    @ApiModelProperty(value = "总数")
    private long total;

}

配置EsManageService相应操作管理类:文章来源地址https://www.toymoban.com/news/detail-774598.html

import com.alibaba.fastjson2.JSON;
import com.huanggr.common.core.domain.EsQueryVo;
import com.huanggr.common.core.domain.PageList;
import com.huanggr.common.core.enums.EsQueryType;
import com.huanggr.common.core.enums.RangeType;
import lombok.extern.slf4j.Slf4j;
import org.elasticsearch.action.admin.indices.create.CreateIndexRequest;
import org.elasticsearch.action.admin.indices.create.CreateIndexResponse;
import org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest;
import org.elasticsearch.action.delete.DeleteRequest;
import org.elasticsearch.action.delete.DeleteResponse;
import org.elasticsearch.action.index.IndexRequest;
import org.elasticsearch.action.index.IndexResponse;
import org.elasticsearch.action.search.SearchRequest;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.action.support.master.AcknowledgedResponse;
import org.elasticsearch.action.update.UpdateRequest;
import org.elasticsearch.action.update.UpdateResponse;
import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.client.RestHighLevelClient;
import org.elasticsearch.client.indices.GetIndexRequest;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.rest.RestStatus;
import org.elasticsearch.search.SearchHit;
import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.elasticsearch.xcontent.XContentType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service
@Slf4j
public class EsManageService {

    @Autowired
    @Qualifier("restHighLevelClient")
    public RestHighLevelClient client;

    /**
     * 创建索引
     * @param index 索引名称
     * @param map   key的Map
     * @return boolean
     * @throws IOException
     */
    public boolean createIndex(String index,Map<String,Object> map) throws IOException {
        //校验索引是否存在
        GetIndexRequest getRequest = new GetIndexRequest(index);
        if(client.indices().exists(getRequest,RequestOptions.DEFAULT)){
            log.info("已存在{}索引",index);
            return true;
        }
        CreateIndexRequest createIndexRequest = new CreateIndexRequest(index);
        createIndexRequest.settings(Settings.builder()
                .put("index.number_of_shards", 1)
                .put("index.number_of_replicas", 0)
        );
        createIndexRequest.mapping("_doc",map);
        CreateIndexResponse createIndexResponse = client.indices().create(createIndexRequest, RequestOptions.DEFAULT);
        return  createIndexResponse.isAcknowledged();
    }

    /**
     * 创建索引
     * @param index 索引名称
     * @param JsonString   String
     * @return boolean
     * @throws IOException
     */
    public boolean createIndex(String index,String JsonString)throws IOException {
        //校验索引是否存在
        GetIndexRequest getRequest = new GetIndexRequest(index);
        if(client.indices().exists(getRequest,RequestOptions.DEFAULT)){
            log.info("已存在{}索引",index);
            return true;
        }
        CreateIndexRequest createIndexRequest = new CreateIndexRequest(index);
        createIndexRequest.settings(Settings.builder()
                .put("index.number_of_shards", 1)
                .put("index.number_of_replicas", 0)
        );
        createIndexRequest.mapping("_doc",JsonString, XContentType.JSON);
        CreateIndexResponse createIndexResponse = client.indices().create(createIndexRequest, RequestOptions.DEFAULT);
        return  createIndexResponse.isAcknowledged();
    }


    //删除索引(删表)
    public Boolean deleteIndex(String index) throws IOException {
        DeleteIndexRequest deleteIndexRequest = new DeleteIndexRequest(index);
        AcknowledgedResponse deleteIndexResponse = client.indices().delete(deleteIndexRequest, RequestOptions.DEFAULT);
        return deleteIndexResponse.isAcknowledged();
    }



    //创建文档(插入数据)
    public Boolean createDocumentByHashMap(HashMap<String,Object> map, String index, String id) throws Exception {

        IndexRequest indexRequest = new IndexRequest(index)
                .id(id).source(map);
        IndexResponse indexResponse = client.index(indexRequest, RequestOptions.DEFAULT);
        return ((IndexResponse) indexResponse).status().equals(RestStatus.OK);
    }


    //更新文档
    public Boolean updateDocumentByMap(HashMap<String,Object> map, String index, String id) throws Exception {
        UpdateRequest updateRequest = new UpdateRequest(index, id);
        updateRequest.doc(map);
        UpdateResponse updateResponse = client.update(updateRequest, RequestOptions.DEFAULT);
        return updateResponse.status().equals(RestStatus.OK);
    }


    //删除文档
    public String deleteDocument(String id,String index) throws Exception {
        DeleteRequest deleteRequest = new DeleteRequest(index, id);
        DeleteResponse response = client.delete(deleteRequest, RequestOptions.DEFAULT);
        return response.getResult().name();
    }

    //查询Es文档
    public PageList searchListByPage(String index, List<EsQueryVo> esQueryVos, int pageNum, int pageSize) throws IOException {
        PageList pageList = new PageList();
        List<Map<String,Object>> hitList = new ArrayList();
        SearchRequest searchRequest = new SearchRequest(index);
        SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
        BoolQueryBuilder queryBuilder = new BoolQueryBuilder();
        if(esQueryVos != null && esQueryVos.size()>0){
            for (EsQueryVo esQueryVo:
                    esQueryVos) {
                clboolQueryBuilder(queryBuilder,esQueryVo);
            }
        }else{
            queryBuilder.must(QueryBuilders.matchAllQuery());
        }
        log.info("queryBuilder查询条件:{}", queryBuilder.toString());
        searchSourceBuilder.query(queryBuilder);
        searchSourceBuilder.from((pageNum-1)*pageSize);
        searchSourceBuilder.size(pageSize);
        searchRequest.source(searchSourceBuilder);
        SearchResponse searchResponse = client.search(searchRequest,RequestOptions.DEFAULT);
        long total = searchResponse.getHits().getTotalHits().value;
        for (SearchHit hit : searchResponse.getHits().getHits()) {
            hitList.add(hit.getSourceAsMap());
            log.info("查询结果:{}", hit.getSourceAsString());
        }
        pageList.setHitList(hitList);
        pageList.setTotal(total);
        return pageList;
    }

    public List<Map<String,Object>> searchList(String index, List<EsQueryVo> esQueryVos) throws IOException {
        List<Map<String,Object>> hitList = new ArrayList();
        SearchRequest searchRequest = new SearchRequest(index);
        SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
        BoolQueryBuilder queryBuilder = new BoolQueryBuilder();
        if(esQueryVos != null && esQueryVos.size()>0){
            for (EsQueryVo esQueryVo:
                    esQueryVos) {
                clboolQueryBuilder(queryBuilder,esQueryVo);
            }
        }else{
            queryBuilder.must(QueryBuilders.matchAllQuery());
        }
        log.info("queryBuilder查询条件:{}", queryBuilder.toString());
        searchSourceBuilder.query(queryBuilder);
        searchRequest.source(searchSourceBuilder);
        SearchResponse searchResponse = client.search(searchRequest,RequestOptions.DEFAULT);
        long total = searchResponse.getHits().getTotalHits().value;
        for (SearchHit hit : searchResponse.getHits().getHits()) {
            hitList.add(hit.getSourceAsMap());
            log.info("查询结果:{}", hit.getSourceAsString());
        }
        return hitList;
    }



    /**
     * 处理流程
     * @param boolQueryBuilder
     * @param esQueryVo
     */
    public void clboolQueryBuilder(BoolQueryBuilder boolQueryBuilder,EsQueryVo esQueryVo){
        if(EsQueryType.term.getCode().equals(esQueryVo.getQueryType())){
            boolQueryBuilder.must(QueryBuilders.termsQuery(esQueryVo.getName(),esQueryVo.getValue()));
        }else if(EsQueryType.prefix.getCode().equals(esQueryVo.getQueryType())){
            boolQueryBuilder.must(QueryBuilders.prefixQuery(esQueryVo.getName(),esQueryVo.getValue()));
        }else if(EsQueryType.range.getCode().equals(esQueryVo.getQueryType())){
            if(RangeType.gt.getCode().equals(esQueryVo.getGteandlte())){
                boolQueryBuilder.must(QueryBuilders.rangeQuery(esQueryVo.getName()).gt(esQueryVo.getValue()));
            }else if(RangeType.gte.getCode().equals(esQueryVo.getGteandlte())){
                boolQueryBuilder.must(QueryBuilders.rangeQuery(esQueryVo.getName()).gte(esQueryVo.getValue()));
            }else if(RangeType.lt.getCode().equals(esQueryVo.getGteandlte())){
                boolQueryBuilder.must(QueryBuilders.rangeQuery(esQueryVo.getName()).lt(esQueryVo.getValue()));
            }else{
                boolQueryBuilder.must(QueryBuilders.rangeQuery(esQueryVo.getName()).lte(esQueryVo.getValue()));
            }
        }else{
            log.error("不存在{}queryType",esQueryVo.getQueryType());
            throw new RuntimeException("不存在"+esQueryVo.getQueryType()+"queryType");
        }
    }

}

四 :相应的运用:

import com.huanggr.common.core.constant.Constants;
import com.huanggr.common.core.domain.EsQueryVo;
import com.huanggr.common.core.domain.PageList;
import com.huanggr.common.core.enums.EsQueryType;
import com.huanggr.common.log.service.EsManageService;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

@Component
public class ApplicationInitEsCreate implements ApplicationRunner {
    @Resource
    private EsManageService esManageService;

    @Override
    public void run(ApplicationArguments args) throws Exception {
        String JsonObject =getOperLogJson();
        esManageService.createIndex(Constants.INDEX_SYS_LOGS,JsonObject);
        List<EsQueryVo> esQueryVos = new ArrayList<>();
        EsQueryVo  esQueryVo = new EsQueryVo("operName","ad", EsQueryType.prefix.getCode(),null);
        esQueryVos.add(esQueryVo);
        PageList res = esManageService.searchListByPage(Constants.INDEX_SYS_LOGS,esQueryVos,1,10);

    }



    public String getOperLogJson(){
        return "{\n" +
                "  \"properties\":{\n" +
                "     \"operId\":{\n" +
                "        \"type\":\"long\"\n" +
                "      },\n" +
                "     \"businessType\":{\n" +
                "        \"type\":\"integer\"\n" +
                "      },\n" +
                "     \"businessTypes\":{\n" +
                "        \"type\":\"keyword\"\n" +
                "      },\n" +
                "     \"method\":{\n" +
                "        \"type\":\"keyword\"\n" +
                "      },\n" +
                "     \"requestMethod\":{\n" +
                "        \"type\":\"keyword\"\n" +
                "      },\n" +
                "     \"operatorType\":{\n" +
                "        \"type\":\"integer\"\n" +
                "      },\n" +
                "     \"operName\":{\n" +
                "        \"type\":\"keyword\"\n" +
                "      },\n" +
                "     \"deptName\":{\n" +
                "        \"type\":\"keyword\"\n" +
                "      },\n" +
                "     \"operUrl\":{\n" +
                "        \"type\":\"keyword\"\n" +
                "      },\n" +
                "     \"operIp\":{\n" +
                "        \"type\":\"keyword\"\n" +
                "      },\n" +
                "     \"operParam\":{\n" +
                "        \"type\":\"keyword\"\n" +
                "      },\n" +
                "     \"jsonResult\":{\n" +
                "        \"type\":\"keyword\"\n" +
                "      },\n" +
                "     \"status\":{\n" +
                "        \"type\":\"integer\"\n" +
                "      },\n" +
                "     \"errorMsg\":{\n" +
                "        \"type\":\"keyword\"\n" +
                "      },\n" +
                "     \"startDate\": {\n" +
                "     \"format\": \"yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis\",\n" +
                "     \"type\": \"date\"\n" +
                "      },\n" +
                "     \"costTime\":{\n" +
                "        \"type\":\"long\"\n" +
                "      },\n" +
                "     \"title\":{\n" +
                "        \"type\":\"keyword\"\n" +
                "     }\n" +
                "  }\n" +
                "}";
    }
}
import com.alibaba.fastjson2.JSON;
import com.huanggr.common.core.constant.Constants;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import com.huanggr.common.core.constant.SecurityConstants;
import com.huanggr.system.api.RemoteLogService;
import com.huanggr.system.api.domain.SysOperLog;

import javax.annotation.Resource;
import java.util.Date;
import java.util.HashMap;
import java.util.UUID;

/**
 * 异步调用日志服务
 *
 * @author huanggr
 */
@Service
public class AsyncLogService
{
    @Autowired
    private RemoteLogService remoteLogService;
    @Resource
    private EsManageService esManageService;


    /**
     * 保存系统日志记录
     */
    @Async
    public void saveSysLog(SysOperLog sysOperLog)
    {
        remoteLogService.saveLog(sysOperLog, SecurityConstants.INNER);
    }


    @Async
    public  void saveSysLogEs(SysOperLog sysOperLog) throws Exception {
        sysOperLog.setOperTime(new Date());
        HashMap<String,Object> map = JSON.parseObject(JSON.toJSONString(sysOperLog), HashMap.class);
        esManageService.createDocumentByHashMap(map, Constants.INDEX_SYS_LOGS, UUID.randomUUID().toString());
    }



}

到了这里,关于springboot引入Elasticsearch的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

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

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

相关文章

  • Elasticsearch基础,SpringBoot整合Elasticsearch

    Elasticsearch,简称为es,es是一个开源的高扩展的分布式全文检索引擎,它可以近乎实时的存储、检索数据;本身扩展性很好,可以扩展到上百台服务器,处理PB级别(大数据时代)的数据。es也使用Java开发并使用Lucene作为其核心来实现所有索引和搜索的功能,但是它的目的是通

    2024年01月19日
    浏览(46)
  • 【ElasticSearch系列-05】SpringBoot整合elasticSearch

    ElasticSearch系列整体栏目 内容 链接地址 【一】ElasticSearch下载和安装 https://zhenghuisheng.blog.csdn.net/article/details/129260827 【二】ElasticSearch概念和基本操作 https://blog.csdn.net/zhenghuishengq/article/details/134121631 【三】ElasticSearch的高级查询Query DSL https://blog.csdn.net/zhenghuishengq/article/details/1

    2024年02月06日
    浏览(42)
  • ElasticSearch8 - SpringBoot整合ElasticSearch

    springboot 整合 ES 有两种方案,ES 官方提供的 Elasticsearch Java API Client 和 spring 提供的 [Spring Data Elasticsearch](Spring Data Elasticsearch) 两种方案各有优劣 Spring:高度封装,用着舒服。缺点是更新不及时,有可能无法使用 ES 的新 API ES 官方:更新及时,灵活,缺点是太灵活了,基本是一

    2024年03月25日
    浏览(97)
  • Elasticsearch是什么,如何学习Elasticsearch,整合SpringBoot

    目录 一、是什么Elasticsearch 二、Elasticsearch,整合SpringBoot 三、Elasticsearch的优势和应用场景   Elasticsearch是一个开源的搜索引擎,它采用Java语言编写,使用Lucene作为核心搜索引擎,并在其基础上构建了分布式的、可扩展的、实时的数据存储和分析引擎 。Elasticsearch最初由Shay B

    2024年02月16日
    浏览(40)
  • Elasticsearch安装、使用,Springboot整合Elasticsearch详细教程

    Elasticsearch 是一个分布式、RESTful 风格的搜索和数据分析引擎,能够实现近乎实时的搜索。 Elasticsearch官网 https://www.elastic.co/cn/ 这篇文章主要简单介绍一下Elasticsearch,Elasticsearch的java API博主也在学习中,文章会持续更新~ 目录 第一步:下载Elasticsearch 下载7.6.2版本 下载其他版本

    2024年02月04日
    浏览(35)
  • Elasticsearch 整合springboot-Elasticsearch文章二

    https://www.elastic.co/cn/ https://docs.spring.io/spring-data/elasticsearch/docs/4.4.10/reference/html/ 我们选用的是elasticsearch 7.17.9版本,对应的,我们需要升级springboot版本,对应的中间件都需要升级 Springboot: 2.7.10 spring-data-elasticsearch: 4.4.10 spring-boot-starter-data-elasticsearch: 2.7.10 https://github.com/OrderDo

    2024年02月15日
    浏览(45)
  • Elasticsearch实战(一):Springboot实现Elasticsearch统一检索功能

    Elasticsearch实战(一):Springboot实现Elasticsearch统一检索功能 Elasticsearch实战(二):Springboot实现Elasticsearch自动汉字、拼音补全,Springboot实现自动拼写纠错 Elasticsearch实战(三):Springboot实现Elasticsearch搜索推荐 Elasticsearch实战(四):Springboot实现Elasticsearch指标聚合与下钻分析

    2024年02月12日
    浏览(43)
  • ElasticSearch系列 - SpringBoot整合ES:ElasticSearch分析器

    1. ElasticSearch match 文本搜索的过程? Elasticsearch 的 match 查询是一种基于文本匹配的查询方式,它的搜索过程如下: ① 将查询字符串分词:Elasticsearch 会将查询字符串分成一个个词项(term),并去除停用词(如“的”、“是”等常用词汇)和标点符号等无意义的字符。 ② 构建

    2023年04月18日
    浏览(124)
  • 【SpringBoot】SpringBoot集成ElasticSearch

    这段代码是一个基本的 Elasticsearch Java 客户端的配置类,用于创建一个 RestHighLevelClient 实例。 其中 RestHighLevelClient 是 Elasticsearch Java 客户端的高级别别名,是基于 LowLevelClient 之上的封装,提供了一些更加方便的方法和功能。 在这段代码中,使用了 @Value 注解来注入三个配置项

    2024年02月04日
    浏览(47)
  • Springboot整合Elasticsearch(一):Linux下安装 Elasticsearch 8.x

    Past Releases of Elastic Stack Software | Elastic elasticsearch-8.8.1-linux-x86_64.tar.gz 安装包路径:/home/ELK_8.8.1 [root@localhost ELK_8.8.1]# tar -zxvf elasticsearch-8.8.1-linux-x86_64.tar.gz 创建新用户es: [root@localhost ELK_8.8.1]# useradd es 设置密码: [root@localhost ELK_8.8.1]# passwd es 设置权限: [root@localhost ELK_8.8.1]# 

    2024年02月09日
    浏览(43)

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

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

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

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

二维码1

领取红包

二维码2

领红包