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
[plain] view plain copy
-
cat /proc/17497/limits
查看系统限制ulimit -a
[plain] view plain copy
-
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
[plain] view plain copy
-
* soft memlock unlimited
-
* hard memlock unlimited
其他可以使用ulimit添加自定义的限制(很多选项系统默认未开启),可以对一些不同用户进行限制
[plain] view plain copy
-
#
-
# – 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
2.禁用内存锁定
vim /etc/security/limits.conf
– memlock unlimited
执行 ulimit -l unlimited
转载请注明:学时网 » elasticsearch启动警告