ElasticSearch之文件描述符的数量

ElasticSearch在运行过程中,涉及大量文件的打开、关闭、读、写等操作。因此当ElasticSearch进程的文件描述符数量不足时可能导致丢失数据等故障现象。

因此为保障ElasticSearch正常运行,需保证ElasticSearch可以使用至少65535个文件描述符。

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

shell 复制代码
ulimit -a

执行结果的样例,如下:

shell 复制代码
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

或者执行如下命令:

shell 复制代码
ulimit -n

执行结果的样例,如下:

shell 复制代码
1024

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

shell 复制代码
ulimit -n 65535
./bin/elasticsearch

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

shell 复制代码
elasticsearch        hard    nofile           65535
elasticsearch        soft    nofile           65535

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

shell 复制代码
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"

执行结果的样例,如下:

shell 复制代码
{
  "nodes" : {
    "aKgBu7LgS9a6iPYH8n2JPw" : {
      "process" : {
        "max_file_descriptors" : 1048576
      }
    }
  }
}

相关资料

相关推荐
NiKo_W1 小时前
Linux 文件系统与基础指令
linux·开发语言·指令
Darkwanderor3 小时前
Linux 的权限详解
linux
SabreWulf20203 小时前
Ubuntu 20.04手动安装.NET 8 SDK
linux·ubuntu·avalonia·.net8
不是吧这都有重名3 小时前
为什么ubuntu大文件拷贝会先快后慢?
linux·运维·ubuntu
sunshine-sm3 小时前
CentOS Steam 9安装 Redis
linux·运维·服务器·redis·centos
小熊h4 小时前
MySQL集群高可用架构——组复制 (MGR)
linux·数据库·mysql
伍哥的传说4 小时前
Lodash-es 完整开发指南:ES模块化JavaScript工具库实战教程
大数据·javascript·elasticsearch·lodash-es·javascript工具库·es模块·按需导入
棒棒的唐4 小时前
armbian平台ubuntu环境下telnet安装及启动,给pantherX2增加一个应急通道
linux·运维·armbian·telnetd
bug攻城狮4 小时前
CentOS 7 设置静态 IP 地址
linux·tcp/ip·centos
纳切威5 小时前
CentOS 7部署Zabbix5.0
linux·运维·centos·zabbix