elasticsearch启动警告无法锁定JVM内存
程序员文章站
2024-02-26 12:32:04
elasticsearch启动警告
unable to lock jvm memory (enomem). this can result in part of the...
elasticsearch启动警告
unable to lock jvm memory (enomem). this can result in part of the jvm being swapped out. increase rlimit_memlock (ulimit).
内存锁定值的限制(max locked memory)
这个值只对普通用户起作用,对超级用户不起作用,这个问题是由于cap_ipc_lock造成的.linux对内存是分页管理的,这意味着有不需要时,在物理内存的数据会被换到交换区或磁盘上.有需要时会被交换到物理内存,而将数据锁定到物理内存可以避免数据的换入/换出.采用锁定内存有两个理由:1)由于程序设计上需要,比如oracle等软件,就需要将数据锁定到物理内存.2)主要是安全上的需要,比如用户名和密码等等,被交换到swap或磁盘,有泄密的可能,所以一直将其锁定到物理内存.
查看项目进程限制,17497为pid
cat /proc/17497/limits
查看系统限制ulimit -a
core file size (blocks, -c) unlimited data seg size (kbytes, -d) unlimited scheduling priority (-e) 0 file size (blocks, -f) unlimited pending signals (-i) 1032980 max locked memory (kbytes, -l) 64 max memory size (kbytes, -m) unlimited open files (-n) 600000 pipe size (512 bytes, -p) 8 posix message queues (bytes, -q) 819200 real-time priority (-r) 0 stack size (kbytes, -s) unlimited cpu time (seconds, -t) unlimited max user processes (-u) 600000 virtual memory (kbytes, -v) unlimited file locks (-x) unlimited
vim /etc/security/limits.conf增加2行,设为更大的值或者unlimited
- soft memlock unlimited
- hard memlock unlimited
其他可以使用ulimit添加自定义的限制(很多选项系统默认未开启),可以对一些不同用户进行限制
# # - core - limits the core file size (kb) # - data - max data size (kb) # - fsize - maximum filesize (kb) # - memlock - max locked-in-memory address space (kb) # - nofile - max number of open files # - rss - max resident set size (kb) # - stack - max stack size (kb) # - cpu - max cpu time (min) # - nproc - max number of processes # - as - address space limit (kb) # - maxlogins - max number of logins for this user # - maxsyslogins - max number of logins on the system # - priority - the priority to run user process with # - locks - max number of file locks the user can hold # - sigpending - max number of pending signals # - msgqueue - max memory used by posix message queues (bytes) # - nice - max nice priority allowed to raise to values: [-20, 19] # - rtprio - max realtime priority
总结
以上就是这篇文章的全部内容了,希望本文的内容对大家的学习或者工作具有一定的参考学习价值,谢谢大家对的支持。如果你想了解更多相关内容请查看下面相关链接