You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Elasticsearch启动卡住求助:首次安装运行停滞2小时

Elasticsearch启动卡住问题排查请求

首次安装运行Elasticsearch,从官网下载压缩包后在PowerShell执行bat文件,安装过程卡住长达2小时。查看Elasticsearch日志,停留在以下内容已达2小时:

[2023-09-27T11:52:26,721][INFO ][o.e.n.Node               ] [WILLIAM-NB] starting ...
[2023-09-27T11:52:26,746][INFO ][o.e.x.s.c.f.PersistentCache] [WILLIAM-NB] persistent cache index loaded
[2023-09-27T11:52:26,748][INFO ][o.e.x.d.l.DeprecationIndexingComponent] [WILLIAM-NB] deprecation component started
[2023-09-27T11:52:26,942][INFO ][o.e.t.TransportService   ] [WILLIAM-NB] publish_address {127.0.0.1:9300}, bound_addresses {127.0.0.1:9300}, {[::1]:9300}
[2023-09-27T11:52:27,321][WARN ][o.e.b.BootstrapChecks    ] [WILLIAM-NB] the default discovery settings are unsuitable for production use; at least one of [discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] must be configured
[2023-09-27T11:52:27,323][WARN ][o.e.b.BootstrapChecks    ] [WILLIAM-NB] Transport SSL must be enabled if security is enabled. Please set [xpack.security.transport.ssl.enabled] to [true] or disable security by setting [xpack.security.enabled] to [false]
[2023-09-27T11:52:27,326][INFO ][o.e.c.c.ClusterBootstrapService] [WILLIAM-NB] this node is locked into cluster UUID [G6RVFPV1SXaWYyvCIAgIPA] and will not attempt further cluster bootstrapping
[2023-09-27T11:52:27,335][INFO ][o.e.c.c.ClusterBootstrapService] [WILLIAM-NB] no discovery configuration found, will perform best-effort cluster bootstrapping after [3s] unless existing master is discovered
[2023-09-27T11:52:27,471][INFO ][o.e.c.s.MasterService    ] [WILLIAM-NB] elected-as-master ([1] nodes joined in term 2)[_FINISH_ELECTION_, {WILLIAM-NB}{XdanMSB1TNO1jUnXrysKvw}{LvdaJhQbRJy-pnl1Te3l3g}{WILLIAM-NB}{127.0.0.1}{127.0.0.1:9300}{cdfhilmrstw}{8.10.2}{7000099-8100299} completing election], term: 2, version: 37, delta: master node changed {previous [], current [{WILLIAM-NB}{XdanMSB1TNO1jUnXrysKvw}{LvdaJhQbRJy-pnl1Te3l3g}{WILLIAM-NB}{127.0.0.1}{127.0.0.1:9300}{cdfhilmrstw}{8.10.2}{7000099-8100299}]}
[2023-09-27T11:52:27,566][INFO ][o.e.c.s.ClusterApplierService] [WILLIAM-NB] master node changed {previous [], current [{WILLIAM-NB}{XdanMSB1TNO1jUnXrysKvw}{LvdaJhQbRJy-pnl1Te3l3g}{WILLIAM-NB}{127.0.0.1}{127.0.0.1:9300}{cdfhilmrstw}{8.10.2}{7000099-8100299}]}, term: 2, version: 37, reason: Publication{term=2, version=37}
[2023-09-27T11:52:27,610][INFO ][o.e.c.f.AbstractFileWatchingService] [WILLIAM-NB] starting file watcher ...
[2023-09-27T11:52:27,629][INFO ][o.e.c.c.NodeJoinExecutor ] [WILLIAM-NB] node-join: [{WILLIAM-NB}{XdanMSB1TNO1jUnXrysKvw}{LvdaJhQbRJy-pnl1Te3l3g}{WILLIAM-NB}{127.0.0.1}{127.0.0.1:9300}{cdfhilmrstw}{8.10.2}{7000099-8100299}] with reason [completing election]
[2023-09-27T11:52:27,618][INFO ][o.e.c.f.AbstractFileWatchingService] [WILLIAM-NB] file settings service up and running [tid=66]
[2023-09-27T11:52:27,706][INFO ][o.e.h.AbstractHttpServerTransport] [WILLIAM-NB] publish_address {127.0.0.1:9200}, bound_addresses {127.0.0.1:9200}, {[::1]:9200}
[2023-09-27T11:52:27,711][INFO ][o.e.n.Node               ] [WILLIAM-NB] started {WILLIAM-NB}{XdanMSB1TNO1jUnXrysKvw}{LvdaJhQbRJy-pnl1Te3l3g}{WILLIAM-NB}{127.0.0.1}{127.0.0.1:9300}{cdfhilmrstw}{8.10.2}{7000099-8100299}{ml.max_jvm_size=8531214336, ml.allocated_processors_double=4.0, ml.allocated_processors=4, ml.machine_memory=17060249600, transform.config_version=10.0.0, xpack.installed=true, ml.config_version=10.0.0}
[2023-09-27T11:52:28,034][INFO ][o.e.l.ClusterStateLicenseService] [WILLIAM-NB] license [b0db676a-9fb9-4361-bae0-764c4b846a33] mode [basic] - valid
[2023-09-27T11:52:28,036][INFO ][o.e.x.s.a.Realms         ] [WILLIAM-NB] license mode is [basic], currently licensed security realms are [reserved/reserved,file/default_file,native/default_native]
[2023-09-27T11:52:28,043][INFO ][o.e.g.GatewayService     ] [WILLIAM-NB] recovered [0] indices into cluster_state
[2023-09-27T11:52:28,151][INFO ][o.e.h.n.s.HealthNodeTaskExecutor] [WILLIAM-NB] Node [{WILLIAM-NB}{XdanMSB1TNO1jUnXrysKvw}] is selected as the current health node.

GC日志最后记录:

[2023-09-27T05:52:00.480+0000][13608][info ][safepoint   ] Safepoint "Cleanup", Time since last: 59513398300 ns, Reaching safepoint: 21400 ns, Cleanup: 39900 ns, At safepoint: 9300 ns, Total: 70600 ns
[2023-09-27T05:55:00.949+0000][13608][info ][safepoint   ] Safepoint "Cleanup", Time since last: 180468467700 ns, Reaching safepoint: 12599 ns, Cleanup: 22801 ns, At safepoint: 2700 ns, Total: 38100 ns
[2023-09-27T05:55:30.229+0000][13608][info ][safepoint   ] Safepoint "Cleanup", Time since last: 29280007900 ns, Reaching safepoint: 18600 ns, Cleanup: 55099 ns, At safepoint: 7700 ns, Total: 81399 ns
[2023-09-27T05:58:30.712+0000][13608][info ][safepoint   ] Safepoint "Cleanup", Time since last: 180483093701 ns, Reaching safepoint: 14600 ns, Cleanup: 37900 ns, At safepoint: 5600 ns, Total: 58100 ns
[2023-09-27T05:59:00.989+0000][13608][info ][safepoint   ] Safepoint "Cleanup", Time since last: 30277152900 ns, Reaching safepoint: 12400 ns, Cleanup: 69400 ns, At safepoint: 5800 ns, Total: 87600 ns
[2023-09-27T05:59:31.220+0000][13608][info ][safepoint   ] Safepoint "Cleanup", Time since last: 30230176900 ns, Reaching safepoint: 17300 ns, Cleanup: 34700 ns, At safepoint: 5800 ns, Total: 57800 ns
[2023-09-27T06:00:28.665+0000][13608][info ][safepoint   ] Safepoint "Cleanup", Time since last: 57444937500 ns, Reaching safepoint: 22200 ns, Cleanup: 27700 ns, At safepoint: 5300 ns, Total: 55200 ns
[2023-09-27T06:00:30.692+0000][13608][info ][safepoint   ] Safepoint "Cleanup", Time since last: 2027746400 ns, Reaching safepoint: 10700 ns, Cleanup: 35100 ns, At safepoint: 5300 ns, Total: 51100 ns
[2023-09-27T06:01:00.954+0000][13608][info ][safepoint   ] Safepoint "Cleanup", Time since last: 30261408400 ns, Reaching safepoint: 12200 ns, Cleanup: 29400 ns, At safepoint: 2800 ns, Total: 44400 ns
[2023-09-27T06:01:25.170+0000][13608][info ][safepoint   ] Safepoint "Cleanup", Time since last: 24216136700 ns, Reaching safepoint: 23500 ns, Cleanup: 37000 ns, At safepoint: 5700 ns, Total: 66200 ns
[2023-09-27T06:01:28.193+0000][13608][info ][safepoint   ] Safepoint "Cleanup", Time since last: 3022886500 ns, Reaching safepoint: 12700 ns, Cleanup: 25100 ns, At safepoint: 3700 ns, Total: 41500 ns
[2023-09-27T06:01:31.233+0000][13608][info ][safepoint   ] Safepoint "Cleanup", Time since last: 3039924100 ns, Reaching safepoint: 11300 ns, Cleanup: 28300 ns, At safepoint: 5000 ns, Total: 44600 ns
[2023-09-27T06:04:00.582+0000][13608][info ][safepoint   ] Safepoint "Cleanup", Time since last: 149348756000 ns, Reaching safepoint: 14300 ns, Cleanup: 37100 ns, At safepoint: 8400 ns, Total: 59800 ns

系统配置:

  • Windows 10 PRO
  • 16GB RAM
  • 108GB 可用空间(非SSD硬盘)
  • 处理器:Intel(R) Core(TM) i7-7500U CPU @ 2.70GHz, 2901 Mhz, 2核4线程

JAVA_HOME配置:

C:\Program Files\Java\jdk1.8.0_181

已确认配置满足官方最低要求,但启动仍卡住,请求排查解决。


排查建议

1. 修复节点发现与安全配置警告

日志中存在两个关键警告,虽不直接导致启动失败,但可能引发后续阻塞:

  • 节点发现配置:单节点环境需明确配置cluster.initial_master_nodes,在config/elasticsearch.yml中添加:
    cluster.initial_master_nodes: ["WILLIAM-NB"]
    
  • 安全配置冲突:当前启用了安全模块但未配置传输SSL,可二选一:
    • 禁用安全模块(适合测试环境):在elasticsearch.yml添加xpack.security.enabled: false
    • 启用传输SSL(需生成证书,适合生产):配置xpack.security.transport.ssl.enabled: true及相关证书路径

2. 检查Java版本兼容性

Elasticsearch 8.10.2要求Java 17(官方捆绑JDK),你使用的JDK 1.8.0_181版本过低,存在兼容性问题。建议:

  • 使用Elasticsearch压缩包自带的JDK(位于jdk目录),无需额外配置JAVA_HOME
  • 若需自行安装JDK,确保使用Java 17 LTS版本

3. 调整JVM堆内存配置

当前JVM堆内存设置为8GB(ml.max_jvm_size=8531214336),对于16GB内存的笔记本,建议调整为4GB以避免系统内存不足:

  • 修改config/jvm.options文件,将-Xms8g和-Xmx8g改为-Xms4g和-Xmx4g

4. 非SSD硬盘的优化措施

机械硬盘IO性能较低,可调整以下配置减少磁盘压力:

  • 禁用磁盘性能监视器(测试环境):在elasticsearch.yml添加monitoring.collection.enabled: false
  • 降低刷新间隔:设置index.refresh_interval: 30s
  • 关闭swap:禁用系统分页文件,或
相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.10 01:58:09