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

相关推荐
虚伪的空想家1 小时前
记录es收集日志报错问题as the final mapping would have more than 1 type[XXX,doc]
大数据·elasticsearch·搜索引擎·容器·kubernetes·log-pilot
Hello.Reader11 小时前
Go-Elasticsearch v9 安装与版本兼容性
elasticsearch·golang·jenkins
数据与人工智能律师11 小时前
数字迷雾中的安全锚点:解码匿名化与假名化的法律边界与商业价值
大数据·网络·人工智能·云计算·区块链
mykyle13 小时前
Elasticsearch-ik分析器
大数据·elasticsearch·jenkins
weixin_lynhgworld15 小时前
淘宝扭蛋机小程序系统开发:重塑电商互动模式
大数据·小程序
SEO_juper15 小时前
企业级 AI 工具选型报告:9 个技术平台的 ROI 对比与部署策略
人工智能·搜索引擎·百度·llm·工具·geo·数字营销
RPA+AI十二工作室17 小时前
影刀RPA_Temu关键词取数_源码解读
大数据·自动化·源码·rpa·影刀
Sui_Network17 小时前
探索 Sui 上 BTCfi 的各类资产
大数据·人工智能·科技·游戏·区块链
大数据张老师19 小时前
用 AI 做数据分析:从“数字”里挖“规律”
大数据·人工智能
博闻录20 小时前
以 “有机” 重构增长:云集从电商平台到健康生活社区的跃迁
大数据·重构·生活