elasticsearch install

使用supervisor 控制es

1.安装java环境

1.安装es

3.配置环境变量

1
cat  <<EOF>>/etc/profile.d/java.sh
2
JAVA_HOME=/usr/java/default
3
PATH=$JAVA_HOME/bin:$PATH
4
CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
5
ES_JAVA_OPTS="-Xms3042 -Xmx3042m"
6
EOF

修改文件描述符解决open file too many

1
cat /etc/sysctl.conf
2
fs.file-max=102400

vm.max_map_count [65530] is too low

1
vm.max_map_count=655360

es check

1
* soft nproc 2048
2
3
* hard nproc 4096
1
[program:es]
2
command=/home/es/elasticsearch/bin/elasticsearch
3
directory=/home/es/elasticsearch/
4
#startsecs=0
5
user=es
6
#stopwaitsecs=0
7
autostart=true
8
autorestart=true
9
redirect_stderr=true
10
stdout_logfile=/dev/stdout
11
stdout_logfile_maxbytes=0

修改supervisor的配置

minfds=100000 #文件描述符大小

解决由于supervisor引起的Too many open files

那么 ElasticSearch 设置的最大文件数到底是多少呢?

1
shell> cat /proc/<ES PID>/limits

ElasticSearch 打开的文件:

1
shell> ls /proc/<PID>/fd