【问题标题】:Deploying Elasticsearch on ecs fargate - HeapDumpOnOutOfMemoryError在 ecs fargate 上部署 Elasticsearch - HeapDumpOnOutOfMemoryError
【发布时间】:2022-07-28 20:44:42
【问题描述】:

我正在尝试在 AWS ECS fargate 服务上部署 elasticsearch。我已经成功部署了一个带有标志 discovery.type=single-node 的 elasticsearch 版本,并且可以正常工作,没有任何问题,但这有一定的内存限制,我不能将它用于生产。

下一步我摆脱了标志discovery.type=single-node,通过堆大小的AWS控制台ES_HEAP_SIZE=10g上的任务定义设置以下环境变量。我还为任务分配了8GB 的内存,并为容器和2vCPUs 分配了相同的内存。

我遇到了一些错误:

  • HeapDumpOnOutOfMemoryError
{"type": "server", "timestamp": "2022-05-01T14:10:45,376Z", "level": "INFO", "component": "o.e.n.Node", "cluster.name": "docker-cluster", "node.name": "ip-172-31-10-153.eu-central-1.compute.internal", "message": "JVM arguments [-Xshare:auto, -Des.networkaddress.cache.ttl=60, -Des.networkaddress.cache.negative.ttl=10, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -XX:-OmitStackTraceInFastThrow, -XX:+ShowCodeDetailsInExceptionMessages, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dio.netty.allocator.numDirectArenas=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -Djava.locale.providers=SPI,COMPAT, --add-opens=java.base/java.io=ALL-UNNAMED, -XX:+UseG1GC, -Djava.io.tmpdir=/tmp/elasticsearch-18437358607495407146, -XX:+HeapDumpOnOutOfMemoryError, -XX:HeapDumpPath=data, -XX:ErrorFile=logs/hs_err_pid%p.log, -Xlog:gc*,gc+age=trace,safepoint:file=logs/gc.log:utctime,pid,tags:filecount=32,filesize=64m, -Des.cgroups.hierarchy.override=/, -Xms4096m, -Xmx4096m, -XX:MaxDirectMemorySize=2147483648, -XX:G1HeapRegionSize=4m, -XX:InitiatingHeapOccupancyPercent=30, -XX:G1ReservePercent=15, -Des.path.home=/usr/share/elasticsearch, -Des.path.conf=/usr/share/elasticsearch/config, -Des.distribution.flavor=default, -Des.distribution.type=docker, -Des.bundled_jdk=true]" }
  • max file descriptors [4096] for elasticsearch process is too low, increase to at least [65535]
  • max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

我尝试了不同的方法,例如 nofile=65535:65535memlock,但对我不起作用。

【问题讨论】:

标签: java docker elasticsearch


【解决方案1】:

vm.max_map_count

AWS ECS Fargate 不允许您更改 vm.max_map_count 值。如果您想坚持使用 Fargate,可以在您的 elasticsearch.yml 文件中添加以下值。但这可能会导致性能下降。

node.store.allow_mmap: false

另一种方法可能是切换到 ECS EC2。在此方案中,您可以更新 vm.max_map_count 值。

ulimits

对于 ulimit,您应该在任务定义处添加的容器中更新它。选择nofile,设置软限制和硬限制,值为65536。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-08-12
    • 2022-10-28
    • 1970-01-01
    • 2021-03-29
    • 1970-01-01
    • 2020-12-04
    • 1970-01-01
    • 2020-12-28
    相关资源
    最近更新 更多