ES elasticsearch安装(8.17)

1、下载windows安装包,当前版本8.17

Download Elasticsearch | Elastic

2、启动,验证

bin目录下面,elasticsearch.bat 命令为其中命令;在启动之前需要先进行配置

2.1、config目录,jvm.options,降低默认内存使用配置,我本地使用默认配置卡

bash 复制代码
## -Xms4g
## -Xmx4g
需要改成
-Xms2g
-Xmx2g

2.2、config目录,elasticsearch.yml

bash 复制代码
# 下面两个改为false,设置为ture需要登录
xpack.security.enabled: false
xpack.security.enrollment.enabled: false


# 下面两个改为false,为true需要https登录
xpack.security.http.ssl:
  enabled: false

xpack.security.transport.ssl:
  enabled: false

启动后,http://localhost:9200

刚开始会报错闪退,cmd到黑窗口执行elasticsearch.bat,提示

bash 复制代码
No found jdk lib下面的tools.jar

我本地安装jdk17,该版本lib目录下面已经没有tools.jar了

解决方法:将jdk1.8里面的tools.jar复制到对应的目录。这样算是把问题解决了。

显示如下内容

html 复制代码
{
  "name" : "DESKTOP-2MKC0A1",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "Cq9-MG7fQlmeB8JTCAm90A",
  "version" : {
    "number" : "8.17.0",
    "build_flavor" : "default",
    "build_type" : "zip",
    "build_hash" : "2b6a7fed44faa321997703718f07ee0420804b41",
    "build_date" : "2024-12-11T12:08:05.663969764Z",
    "build_snapshot" : false,
    "lucene_version" : "9.12.0",
    "minimum_wire_compatibility_version" : "7.17.0",
    "minimum_index_compatibility_version" : "7.0.0"
  },
  "tagline" : "You Know, for Search"
}

3、默认访问http://localhost:9200,需要登录的,默认用户elastic,但是密码却没有默认的

3.1、重置elastic密码,

使用命令 elasticsearch-reset-password --username elastic

这样新的密码就显示在下面,可以这样密码很繁琐

bash 复制代码
C:\Users\HP\Downloads\elasticsearch-8.17.0\bin>elasticsearch-reset-password -u elastic
warning: ignoring JAVA_HOME=D:\java\jdk17; using bundled JDK
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]y


Password for the [elastic] user successfully reset.
New value: xUvsSUv0W4+Rde*JE-ty

3.2、修改用户的密码。

使用命令 elasticsearch-reset-password --username elastic -i

bash 复制代码
C:\Users\HP\Downloads\elasticsearch-8.17.0\bin>elasticsearch-reset-password --username elastic -i
warning: ignoring JAVA_HOME=D:\java\jdk17; using bundled JDK
This tool will reset the password of the [elastic] user.
You will be prompted to enter the password.
Please confirm that you would like to continue [y/N]y


Enter password for [elastic]:
Re-enter password for [elastic]:
Password for the [elastic] user successfully reset.

4、安装ES-head,它是一个elasticsearch的web界面工具

4.1、安装准备,需要本地node.js

4.2、通过node.js 安装grunt

bash 复制代码
C:\Users\HP\Downloads\elasticsearch-8.17.0\bin>node --version
v20.11.0

C:\Users\HP\Downloads\elasticsearch-8.17.0\bin>npm install -g grunt-cli

added 56 packages in 5s

5 packages are looking for funding
  run `npm fund` for details
npm notice
npm notice New major version of npm available! 10.5.0 -> 11.0.0
npm notice Changelog: https://github.com/npm/cli/releases/tag/v11.0.0
npm notice Run npm install -g npm@11.0.0 to update!
npm notice

C:\Users\HP\Downloads\elasticsearch-8.17.0\bin>grunt -version
grunt-cli v1.5.0

4.3、下载es-head源码

https://github.com/mobz/elasticsearch-head

查看redme操作,如果本地没有git的,可以直接下载

bash 复制代码
Running with built in server
git clone git://github.com/mobz/elasticsearch-head.git
cd elasticsearch-head
npm install
npm run start
open http://localhost:9100/

4.4、访问http://localhost:9100, 提示连不上http://localhost:9200,是因为elasticsearch默认配置不能跨域访问,需要修改配置

bash 复制代码
# 增加配置,允许跨域,这样head插件可以访问es
http.cors.enabled: true 
http.cors.allow-origin: "*"
@注意,设置参数的时候:后面要有空格

4.5、提示还是不能连接elasticsearch服务,此时访问的地址为http://localhost:9100,需要加上用户名和密码参数 http://localhost:9100?auth_user=elastic\&auth_password=elastic

相关推荐
写代码的【黑咖啡】2 分钟前
大数据中的数据同步预处理:保障数据质量的第一道防线
大数据
Hello.Reader7 分钟前
Flink SQL Time Travel用 FOR SYSTEM_TIME AS OF 查询历史快照
大数据·sql·flink
2501_9247949013 分钟前
企业AI转型为何难?——从“不敢用”到“用得稳”的路径重构
大数据·人工智能·重构
Tezign_space25 分钟前
小红书内容运营工具怎么选?专业视角拆解优质工具核心标准
大数据·人工智能·内容运营
康实训28 分钟前
养老实训室建设标准指南
大数据·人工智能·实训室·养老实训室·实训室建设
semantist@语校2 小时前
第五十五篇|从解释约束到结构化认知:京都国际学院的语言学校Prompt工程化实践
大数据·数据库·人工智能·python·百度·prompt·知识图谱
计算机毕业编程指导师2 小时前
【Python大数据选题】基于Spark+Django的电影评分人气数据可视化分析系统源码 毕业设计 选题推荐 毕设选题 数据分析 机器学习
大数据·hadoop·python·计算机·spark·django·电影评分人气
TDengine (老段)2 小时前
使用 deepseek 快速搭建 TDengine IDMP demo
大数据·数据库·科技·ai·时序数据库·tdengine·涛思数据
Jackyzhe3 小时前
Flink源码阅读:如何生成StreamGraph
大数据·flink
Hello.Reader3 小时前
Flink SQL Window Deduplication按窗口“保留第一条/最后一条”记录(Streaming)
大数据·sql·flink