elasticsearch安装参数配置注意事项
在elasticsearch安装时,有几个重要的参数配置需要我们注意:
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.作为一个服务运行
请参考:elasticsearch service安装