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

相关推荐
Elasticsearch28 分钟前
Elasticsearch:如何在 ES|QL 中使用 FORK 及 FUSE 命令来实现混合搜索 - 9.1+
elasticsearch
说私域1 小时前
定制开发AI智能名片S2B2C预约服务小程序的定制开发与优势分析
大数据·人工智能·小程序
武子康2 小时前
大数据-155 Apache Druid 存储与查询架构实战:Segment/Chunk/Roll-up/Bitmap 一文讲清
大数据·后端·nosql
ITVV3 小时前
计算引擎 Flink 1.19.3
大数据·flink
HillVue4 小时前
重估百度,也是在重估 AI 的未来
大数据·人工智能·sqlite
zxsz_com_cn5 小时前
设备健康管理诊断报告生成:工业智能化的“决策引擎”与效率革命
大数据
FPGA小迷弟10 小时前
ChatGPT回答用AI怎么怎么赚钱
大数据·人工智能
AllData公司负责人10 小时前
实时开发平台(Streampark)--Flink SQL功能演示
大数据·前端·架构·flink·开源
小坏讲微服务12 小时前
MaxWell中基本使用原理 完整使用 (第一章)
大数据·数据库·hadoop·sqoop·1024程序员节·maxwell
2301_7976042414 小时前
d47:Elasticsearch入门
elasticsearch