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

相关推荐
nangonghen14 分钟前
flink operator v1.10部署flink v1.19.2
大数据·flink·flink operator
LaughingZhu36 分钟前
PH热榜 | 2025-02-23
前端·人工智能·经验分享·搜索引擎·产品运营
大数据追光猿9 小时前
Python应用算法之贪心算法理解和实践
大数据·开发语言·人工智能·python·深度学习·算法·贪心算法
人类群星闪耀时11 小时前
物联网与大数据:揭秘万物互联的新纪元
大数据·物联网·struts
risc12345611 小时前
【Elasticsearch】Search Templates(搜索模板)
elasticsearch
桃林春风一杯酒17 小时前
HADOOP_HOME and hadoop.home.dir are unset.
大数据·hadoop·分布式
桃木山人17 小时前
BigData File Viewer报错
大数据·java-ee·github·bigdata
B站计算机毕业设计超人17 小时前
计算机毕业设计Python+DeepSeek-R1高考推荐系统 高考分数线预测 大数据毕设(源码+LW文档+PPT+讲解)
大数据·python·机器学习·网络爬虫·课程设计·数据可视化·推荐算法
数造科技17 小时前
紧随“可信数据空间”政策风潮,数造科技正式加入开放数据空间联盟
大数据·人工智能·科技·安全·敏捷开发
逸Y 仙X21 小时前
Git常见命令--助力开发
java·大数据·git·java-ee·github·idea