- Elasticsearch 7.0 Cookbook(Fourth Edition)
- Alberto Paro
- 208字
- 2021-06-24 14:51:52
How to do it…
To improve the performance on Linux systems, we will perform the following steps:
- First, you need to change the current limit for the user that runs the Elasticsearch server. In these examples, we will call this elasticsearch.
- To allow Elasticsearch to manage a large number of files, you need to increment the number of file descriptors (number of files) that a user can manage. To do so, you must edit your /etc/security/limits.conf file and add the following lines at the end:
elasticsearch - nofile 65536
elasticsearch - memlock unlimited
- Then, a machine restart is required to be sure that the changes have been made.
- The new version of Ubuntu (that is, version 16.04 or later) can skip the /etc/security/limits.conf file in the init.d scripts. In these cases, you need to edit /etc/pam.d/ and remove the following comment line:
# session required pam_limits.so
- To control memory swapping, you need to set up the following parameter in elasticsearch.yml:
bootstrap.memory_lock
- To fix the memory usage size of the Elasticsearch server, we need to set up the same values for Xmsand Xmx in $ES_HOME/config/jvm.options (that is, we set 1 GB of memory in this case), as follows:
-Xms1g
-Xmx1g