Elasticsearch宕机问题
Posted 字节
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Elasticsearch宕机问题相关的知识,希望对你有一定的参考价值。
个人博客:https://blog.sharedata.info/
Elasticsearch 突然宕机,每次重启都只生成错误日志
报错信息:
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (mmap) failed to map 10039525376 bytes for committing reserved memory.
# Possible reasons:
# The system is out of physical RAM or swap space
# In 32 bit mode, the process size limit was hit
# Possible solutions:
# Reduce memory load on the system
# Increase physical memory or swap space
# Check if swap backing store is full
# Use 64 bit Java on a 64 bit OS
# Decrease Java heap size (-Xmx/-Xms)
# Decrease number of Java threads
# Decrease Java thread stack sizes (-Xss)
# Set larger code cache with -XX:ReservedCodeCacheSize=
# This output file may be truncated or incomplete.
#
# Out of Memory Error (os_linux.cpp:2627), pid=6337, tid=0x00007f6e8f0a3700
#
# JRE version: (8.0_111-b14) (build )
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.111-b14 mixed mode linux-amd64 compressed oops)
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
--------------- T H R E A D ---------------
Current thread (0x00007f6e8800a800): JavaThread "Unknown thread" [_thread_in_vm, id=6339, stack(0x00007f6e8efa3000,0x00007f6e8f0a4000)]
Stack: [0x00007f6e8efa3000,0x00007f6e8f0a4000], sp=0x00007f6e8f0a22d0, free space=1020k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V [libjvm.so+0xac5c2a] VMError::report_and_die()+0x2ba
V [libjvm.so+0x4fc50b] report_vm_out_of_memory(char const*, int, unsigned long, VMErrorType, char const*)+0x8b
V [libjvm.so+0x922ae3] os::Linux::commit_memory_impl(char*, unsigned long, bool)+0x103
V [libjvm.so+0x923039] os::pd_commit_memory(char*, unsigned long, unsigned long, bool)+0x29
V [libjvm.so+0x91d33a] os::commit_memory(char*, unsigned long, unsigned long, bool)+0x2a
V [libjvm.so+0xac1989] VirtualSpace::expand_by(unsigned long, bool)+0x199
V [libjvm.so+0xac24de] VirtualSpace::initialize(ReservedSpace, unsigned long)+0xee
V [libjvm.so+0x5f9e61] CardGeneration::CardGeneration(ReservedSpace, unsigned long, int, GenRemSet*)+0xf1
V [libjvm.so+0x4e5c2e] ConcurrentMarkSweepGeneration::ConcurrentMarkSweepGeneration(ReservedSpace, unsigned long, int, CardTableRS*, bool, FreeBlockDictionary<FreeChunk>::DictionaryChoice)+0x4e
V [libjvm.so+0x5faf22] GenerationSpec::init(ReservedSpace, int, GenRemSet*)+0xf2
V [libjvm.so+0x5e9d5e] GenCollectedHeap::initialize()+0x1de
V [libjvm.so+0xa8dd53] Universe::initialize_heap()+0xf3
V [libjvm.so+0xa8e2be] universe_init()+0x3e
V [libjvm.so+0x63c925] init_globals()+0x65
V [libjvm.so+0xa719be] Threads::create_vm(JavaVMInitArgs*, bool*)+0x23e
V [libjvm.so+0x6d11c4] JNI_CreateJavaVM+0x74
C [libjli.so+0x745e] JavaMain+0x9e
C [libpthread.so.0+0x7aa1] start_thread+0xd1
----------
根据报错信息应该是内存溢出了,排查一下内存状况,发现内存充足,此时es分配给8G的内存
1:上调内存到10G发现还是崩溃,继续排查,然后查看硬盘已经使用了40%
2:物理硬盘内存小而jvm的内存分配过大导致的,调整了jvm的内存大小重新访问可以了,调整内存到4G然后就可以访问了
编辑:jvm.options
-Xms4g
-Xmx4g
以上是关于Elasticsearch宕机问题的主要内容,如果未能解决你的问题,请参考以下文章
Elasticsearches 模糊查询导致Elasticsearch服务宕机
错误 [内部] 为 docker.elastic.co/elasticsearch/elasticsearch:7.12.0 加载元数据
Logstash+elasticsearch+elastic+nignx