在安裝時,有幾個重要的參數配置需要我們注意:
1.文件描述
在http://www.elasticsearch.org/guide/reference/setup/installation/這樣描述:
Make sure to increase the number of open files descriptors on the machine (or for the user running elasticsearch). Setting it to 32k or even 64k is recommended.
In order to test how many open files the process can open, start it with -Des.max-open-files set to true. This will print the number of open files the process can open on startup.
關於第一句話就是我們的文件描述符配置設置爲32k或者64k,具體配置爲:
在linux系統:
/etc/security/limits.conf
編輯該文件,後面加上:
xq soft nofile 65536
xq hard nofile 65536
備註:xq爲用戶名,同時確保xq用戶擁有次命令權限
用vi 編輯bin/elasticsearch文件後面加入
-Des.max-open-files=ture
這樣在 運行命令
sh elasticsearch
就可以看得文件描述符的大小了
2.內存設置
elasticsearch內存設置爲:
bootstrap.mlockall: true
這樣可以elasticsearch確保使用物理內存,不使用linux swap 。
在
/etc/security/limits.conf
編輯該文件,後面加上:
xq -memlock unlimited
備註:xq爲用戶名,同時確保xq用戶擁有次命令權限
或者直接編輯/etc/profile文件,在後面加上
ulimit -l unlimited
3.作爲一個服務運行