ElasticSearch之文件描述符的数量

ElasticSearch在运行过程中,涉及大量文件的打开、关闭、读、写等操作。因此当ElasticSearch进程的文件描述符数量不足时可能导致丢失数据等故障现象。
因此为保障ElasticSearch正常运行,需保证ElasticSearch可以使用至少65535个文件描述符。

查看Linux系统当前用户的文件描述符的数量,命令如下:

ulimit -a

执行结果的样例,如下:

core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 15172
max locked memory (kbytes, -l) 65536
max memory size (kbytes, -m) unlimited
open files (-n) 1024
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 15172
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited

或者执行如下命令:

ulimit -n

执行结果的样例,如下:

1024

在启动ElasticSearch前,使用root用户指定文件描述符的数量,命令样例如下:

ulimit -n 65535
./bin/elasticsearch

使用root用户修改Linux系统的配置文件/etc/security/limits.conf,增加如下内容:

elasticsearch hard nofile 65535
elasticsearch soft nofile 65535

查看当前Elasticsearch进程的文件描述符的最大数量,命令如下:

curl -X GET "https://localhost:9200/_nodes/stats/process?filter_path=**.max_file_descriptors&pretty" --cacert $ES_HOME/config/certs/http_ca.crt -u "elastic:ohCxPH=QBE+s5=*lo7F9"

执行结果的样例,如下:

{
"nodes" : {
"aKgBu7LgS9a6iPYH8n2JPw" : {
"process" : {
"max_file_descriptors" : 1048576
}
}
}
}

相关资料

posted @   jackieathome  阅读(33)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
点击右上角即可分享
微信分享提示