Windows安装ES8.10流程及安装过程中出现的问题
目录
下载安装
普通配置
问题1
原因
解决方案
问题2
原因
解决方案
问题3
原因
解决方案(下载ik分词器)
问题4
原因
解决方案(禁用 HTTPS 和安全功能 仅限本地测试环境)
IK分词器是干啥的?
为什么要安装 IK 分词器呢?
下载安装
下载:点击https://www.elastic.co/cn/downloads/elasticsearch
-->
点击View past releases
-->
找到你所需要的
版本的ES
由于我找不到所以我直接输入下面的地址去安装
https://www.elastic.co/downloads/past-releases/elasticsearch-8-10-0
下载完解压就好
普通配置
- 进入:
WIN
键搜索并点击 编辑系统环境变量-->
点击环境变量--->
点击系统变量下新建按钮 - 输入:变量名输入
ES_HOME
,变量值为ES
的安装目录(bin
目录的上级) - 添加:双击
PATH
变量--->
点击新建—>输入%ES_HOME%\bin
- 输入:变量名输入
ES_JAVA_HOME
,变量值为JDK
目录的路径(与bin
目录同级) - 乱码:进入
config
目录--->
打开jvm.options
文件—>末尾添加-Dfile.encoding=GBK
- 配置:进入
config
目录--->
打开elasticsearch.yml
文件,做如下修改
# 设置集群的名字
cluster.name: es# 设置主节点名字
node.name: esNodeOne#设置索引数据的存储路径
path.data: ./data #换成自己的路径
#设置日志文件的存储路径
path.logs: ./logs #换成自己的路径# 设置ES监听地址,默认为192.168.0.1; 0.0.0.0: 任意机器都可访问
network.host: 0.0.0.0#设置对外服务的http端口,默认为9200
http.port: 9200
问题1
启动ES时,报错如下warning: ignoring JAVA_HOME=C:\Program Files\Java\jdk-17.0.4.1; using ES_JAVA_HOME
Aborting auto configuration because of config dir ownership mismatch. Config dir is owned by DESKTOP-55QC1OD\dell but auto-configuration directory would be owned by BUILTIN\Administrators
Exception in thread "main" java.lang.RuntimeException: starting java failed with [1]
output:
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (mmap) failed to map 12767461376 bytes for G1 virtual space
# An error report file with more information is saved as:
# logs/hs_err_pid2252.log
error:
Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x0000000507000000, 12767461376, 0) failed; error='???????С?????????????' (DOS error/errno=1455)
at org.elasticsearch.server.cli.JvmOption.flagsFinal(JvmOption.java:120)
at org.elasticsearch.server.cli.JvmOption.findFinalOptions(JvmOption.java:87)
原因
两个新问题:内存不足和配置文件权限问题
解决方案
编辑 config/jvm.options.d/jvm.options
文件:
# 设置较小的堆内存(根据您的系统调整)
-Xms1g
-Xmx1g
然后以管理员身份打开cmd窗口
问题2
E:\ES\elasticsearch-8.10.0\bin>elasticsearch.bat
warning: ignoring JAVA_HOME=C:\Program Files\Java\jdk-17.0.4.1; using ES_JAVA_HOME
Aborting auto configuration because of config dir ownership mismatch. Config dir is owned by DESKTOP-55QC1OD\dell but auto-configuration directory would be owned by BUILTIN\Administrators
ERROR: encountered [3] errors parsing [E:\ES\elasticsearch-8.10.0\config\jvm.options]
[1]: encountered improperly formatted JVM option in [E:\ES\elasticsearch-8.10.0\config\jvm.options] on line number [1]: [?################################################################]
[2]: encountered improperly formatted JVM option in [E:\ES\elasticsearch-8.10.0\config\jvm.options] on line number [32]: [ -Xms2g]
[3]: encountered improperly formatted JVM option in [E:\ES\elasticsearch-8.10.0\config\jvm.options] on line number [33]: [ -Xmx2g]
, with exit code 78
原因
- JVM 选项文件格式错误
- 配置文件目录权限问题
解决方案
修复 jvm.options 文件格式 为 UTF-8
删除32行和33行的前导空格
问题3
E:\ES\elasticsearch-8.10.0\bin>elasticsearch.bat warning: ignoring JAVA_HOME=C:\Program Files\Java\jdk-17.0.4.1; using ES_JAVA_HOME Aborting auto configuration because of config dir ownership mismatch. Config dir is owned by DESKTOP-55QC1OD\dell but auto-configuration directory would be owned by BUILTIN\Administrators [2025-09-16T21:30:16,564][INFO ][o.e.n.Node ] [esNodeOne] version[8.10.0], pid[10040], build[zip/e338da74c79465dfdc204971e600342b0aa87b6b/2023-09-07T08:16:21.960703010Z], OS[Windows 11/10.0/amd64], JVM[Oracle Corporation/Java HotSpot(TM) 64-Bit Server VM/17.0.4.1/17.0.4.1+1-LTS-2] [2025-09-16T21:30:16,573][INFO ][o.e.n.Node ] [esNodeOne] JVM home [C:\Program Files\Java\jdk-17.0.4.1], using bundled JDK [false] [2025-09-16T21:30:16,573][INFO ][o.e.n.Node ] [esNodeOne] JVM arguments [-Des.networkaddress.cache.ttl=60, -Des.networkaddress.cache.negative.ttl=10, -Djava.security.manager=allow, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -XX:-OmitStackTraceInFastThrow, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -Dlog4j2.formatMsgNoLookups=true, -Djava.locale.providers=SPI,COMPAT, --add-opens=java.base/java.io=org.elasticsearch.preallocate, -Xms1g, -Xmx1g, -XX:+UseG1GC, -Djava.io.tmpdir=C:\Users\dell\AppData\Local\Temp\elasticsearch, -XX:+HeapDumpOnOutOfMemoryError, -XX:+ExitOnOutOfMemoryError, -XX:HeapDumpPath=data, -XX:ErrorFile=logs/hs_err_pid%p.log, -Xlog:gc*,gc+age=trace,safepoint:file=logs/gc.log:utctime,level,pid,tags:filecount=32,filesize=64m, -Dfile.encoding=GBK, -XX:MaxDirectMemorySize=536870912, -XX:G1HeapRegionSize=4m, -XX:InitiatingHeapOccupancyPercent=30, -XX:G1ReservePercent=15, -Des.distribution.type=zip, --module-path=E:\ES\elasticsearch-8.10.0\lib, --add-modules=jdk.net, --add-modules=org.elasticsearch.preallocate, -Djdk.module.main=org.elasticsearch.server] [2025-09-16T21:30:16,774][ERROR][o.e.b.Elasticsearch ] [esNodeOne] fatal exception while booting Elasticsearchjava.lang.IllegalStateException: Plugin [analysis-ik-Latest.zip] is missing a descriptor properties file. at org.elasticsearch.server@8.10.0/org.elasticsearch.plugins.PluginDescriptor.readFromProperties(PluginDescriptor.java:199) at org.elasticsearch.server@8.10.0/org.elasticsearch.plugins.PluginsUtils.readPluginBundle(PluginsUtils.java:185) at org.elasticsearch.server@8.10.0/org.elasticsearch.plugins.PluginsUtils.findBundles(PluginsUtils.java:166) at org.elasticsearch.server@8.10.0/org.elasticsearch.plugins.PluginsUtils.getPluginBundles(PluginsUtils.java:148) at org.elasticsearch.server@8.10.0/org.elasticsearch.plugins.PluginsService.<init>(PluginsService.java:164) See logs for more details. ERROR: Elasticsearch did not exit normally - check the logs at E:\ES\elasticsearch-8.10.0\logs\es.log ERROR: Elasticsearch exited unexpectedly, with exit code 1
原因
遇到了 IK 分词器插件的问题
解决方案(下载ik分词器)
删除有问题的插件ik分词器的压缩包和目录
安装对应版本的ik分词器,由于我并没有在github中找到对应版本的ik分词器,我使用了命令的方式安装ik分词器
cd E:\ES\elasticsearch-8.10.0\bin
elasticsearch-plugin install https://get.infini.cloud/elasticsearch/analysis-ik/8.10.0
问题4
E:\ES\elasticsearch-8.10.0\bin>elasticsearch.bat
warning: ignoring JAVA_HOME=C:\Program Files\Java\jdk-17.0.4.1; using ES_JAVA_HOME
Aborting auto configuration because of config dir ownership mismatch. Config dir is owned by DESKTOP-55QC1OD\dell but auto-configuration directory would be owned by BUILTIN\Administrators
[2025-09-16T21:38:32,358][INFO ][o.e.n.Node ] [esNodeOne] version[8.10.0], pid[15984], build[zip/e338da74c79465dfdc204971e600342b0aa87b6b/2023-09-07T08:16:21.960703010Z], OS[Windows 11/10.0/amd64], JVM[Oracle Corporation/Java HotSpot(TM) 64-Bit Server VM/17.0.4.1/17.0.4.1+1-LTS-2]
[2025-09-16T21:38:32,365][INFO ][o.e.n.Node ] [esNodeOne] JVM home [C:\Program Files\Java\jdk-17.0.4.1], using bundled JDK [false]
[2025-09-16T21:38:32,365][INFO ][o.e.n.Node ] [esNodeOne] JVM arguments [-Des.networkaddress.cache.ttl=60, -Des.networkaddress.cache.negative.ttl=10, -Djava.security.manager=allow, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -XX:-OmitStackTraceInFastThrow, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -Dlog4j2.formatMsgNoLookups=true, -Djava.locale.providers=SPI,COMPAT, --add-opens=java.base/java.io=org.elasticsearch.preallocate, -Xms1g, -Xmx1g, -XX:+UseG1GC, -Djava.io.tmpdir=C:\Users\dell\AppData\Local\Temp\elasticsearch, -XX:+HeapDumpOnOutOfMemoryError, -XX:+ExitOnOutOfMemoryError, -XX:HeapDumpPath=data, -XX:ErrorFile=logs/hs_err_pid%p.log, -Xlog:gc*,gc+age=trace,safepoint:file=logs/gc.log:utctime,level,pid,tags:filecount=32,filesize=64m, -Dfile.encoding=GBK, -XX:MaxDirectMemorySize=536870912, -XX:G1HeapRegionSize=4m, -XX:InitiatingHeapOccupancyPercent=30, -XX:G1ReservePercent=15, -Des.distribution.type=zip, --module-path=E:\ES\elasticsearch-8.10.0\lib, --add-modules=jdk.net, --add-modules=org.elasticsearch.preallocate, -Djdk.module.main=org.elasticsearch.server]
[2025-09-16T21:38:35,325][INFO ][o.e.p.PluginsService ] [esNodeOne] loaded module [repository-url]
[2025-09-16T21:38:35,326][INFO ][o.e.p.PluginsService ] [esNodeOne] loaded module [rest-root]
[2025-09-16T21:38:35,326][INFO ][o.e.p.PluginsService ] [esNodeOne] loaded module [x-pack-core]
[2025-09-16T21:38:35,327][INFO ][o.e.p.PluginsService ] [esNodeOne] loaded module [x-pack-redact]
[2025-09-16T21:38:35,327][INFO ][o.e.p.PluginsService ] [esNodeOne] loaded module [ingest-user-agent]
[2025-09-16T21:38:35,334][INFO ][o.e.p.PluginsService ] [esNodeOne] loaded module [snapshot-repo-test-kit]
[2025-09-16T21:38:35,334][INFO ][o.e.p.PluginsService ] [esNodeOne] loaded module [ml-package-loader]
[2025-09-16T21:38:35,334][INFO ][o.e.p.PluginsService ] [esNodeOne] loaded module [kibana]
[2025-09-16T21:38:35,335][INFO ][o.e.p.PluginsService ] [esNodeOne] loaded module [constant-keyword]
[2025-09-16T21:38:35,335][INFO ][o.e.p.PluginsService ] [esNodeOne] loaded module [x-pack-
ERROR: Elasticsearch exited unexpectedly, with exit code 78
原因
- 发现设置问题:需要配置
discovery.seed_hosts
或cluster.initial_master_nodes
- SSL 问题:安全启用时需要开启传输层 SSL
解决方案(禁用 HTTPS 和安全功能 仅限本地测试环境)
参考下面最终版的elasticsearch.yml文件
# 设置集群的名字
cluster.name: es# 设置主节点名字
node.name: esNodeOne#设置索引数据的存储路径
path.data: ./data #换成自己的路径
#设置日志文件的存储路径
path.logs: ./logs #换成自己的路径# 设置ES监听地址,默认为192.168.0.1; 0.0.0.0: 任意机器都可访问
network.host: 0.0.0.0#设置对外服务的http端口,默认为9200
http.port: 9200# 禁用安全功能
xpack.security.enabled: false# 配置单节点发现
discovery.type: single-node# 禁用其他安全相关功能
xpack.security.transport.ssl.enabled: false
xpack.security.http.ssl.enabled: false
再次运行elasticsearch.bat命令
可以看到
重新启动新的cmd窗口进行测试
curl http://localhost:9200/
已经启动成功!!!
IK分词器是干啥的?
传统的分词工具往往难以准确处理中文的歧义和复杂语境,而IK分词器可以:识别中文词组、处理专有名词、智能切分复杂句子。
为什么要安装 IK 分词器呢?
Elasticsearch 默认的分词器(如 standard analyzer)针对英文等西方语言设计,对中文文本处理效果极其有限。这主要是因为英文单词之间有空格,而中文是连续书写的,没有自然分词的边界,标准的分词器会逐字切分,导致语义完全丢失。
比如说 程序员爱编程,默认的分词器会分割为 程 | 序 | 员 | 爱 | 编 | 程,IK 分词器能够切分为 程序员|爱|编程。
IK分词器提供了两种主要分词模式:ik_max_word,最细粒度的分词模式,会穷尽所有可能的分词组合,适合全文检索;ik_smart,智能分词模式,最少分词,尽可能保留语义完整的词组,适合精准匹配。
如果我的内容对你有帮助,请辛苦动动您的手指为我点赞,评论,收藏。感谢大家!!