Elastic Search, Logstash and Kibana (ELK) is an end-to-end stack which provides realtime analytics for almost any type of structured or unstructured data.
When importing large amounts of data using Logstash to Elastic Search (ES), the chances are that ES hit the limits of the maximum files it can open. This limit is seen as an error in the ES logs with the following description: (Too many open files)
To deal with this you can increase the maximum files ES (or any process) may open using the following steps:
2. Now execute the following commands to increase the maximum number of files a process may open:
- sudo sysctl -w kern.maxfilesperproc=32000
3. Execute the following commands to set the file limit for the terminal process (this is the terminal window to launch ES in)
- ulimit -Hn 32000
For ES 1.7:
Start Elastic Search with the following command: ./elasticsearch -Des.max-open-files -XX:-MaxFDLimit=true
For ES 2.2
Execute the following commands:
and then start ES with the following command:
./elasticsearch -Des.max-open-files (max_open_files should be 32000 now)
Heap sizes
You may also need to increase the heap size of both Logstash and Elastic Search.
To increase the heap of Elastic Search execute the following command before launching ES: export ES_HEAP_SIZE=8g
When importing large files using Logstash, it may benefit to increase the number of workers to speed up the importing process. The default is 1. See the following example of the elasticsearch output plugin in Logstash:
elasticsearch {
action => "index"
hosts => ["localhost"]
index => "logstash-%{+YYYY.MM.dd}"
workers => 4
flush_size => 1000
}
No comments:
Post a Comment