ELKF之elasticsearch安装配置
第三方依赖
- java运行环境
java8及以上( Java 1.8.0_73 以上)
下载安装
$ cd ~
$ wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.5.0.tar.gz
$ tar -zxvf elasticsearch-5.5.0.tar.gz
配置
配置系统参数
- vm.max_map_count
max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
# sysctl -a | grep "vm.max_map_count"
# sysctl -w vm.max_map_count=655360
# sysctl -a | grep "vm.max_map_count"
- 文件描述符配置
文件描述符配置设置为32k或者64k
max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
sim soft nofile 65536
sim hard nofile 65536
$ cd $ES_HOME && vim bin/elasticsearch
-Des.max-open-files=true
位于如下位置
exec "$JAVA" $ES_JAVA_OPTS -Des.max-open-files=true
- max number of threads
max number of threads [1024] for user [sim] is too low, increase to at least [2048]
# vim /etc/security/limits.conf #追加如下
sim soft nproc 4096
sim hard nproc 4096
# vim /etc/security/limits.conf #追加如下,sim为用户名,同时确保用户有此命令权限
sim soft memlock unlimited
sim hard memlock unlimited
# vim /etc/sysctl.conf
vm.swappiness=0
# sysctl -p
# vim /etc/pam.d/sshd #ssh登录生效,追加
session required /lib64/security/pam_limits.so
# vim /etc/pam.d/login #登录生效,追加
session required /lib64/security/pam_limits.so
-A INPUT -p tcp -m state --state NEW -m tcp --dport 9200 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 9300 -j ACCEPT
配置环境变量
export ES_HOME=/home/sim/elasticsearch-5.5.0
export PATH=$ES_HOME/bin:$PATH
$ vim ~/.bash_profile
export ES_HOME=~/elasticsearch-5.5.0
export PATH=$ES_HOME/bin:$PATH
$ source ~/.bash_profile
配置
$ echo $ES_HOME
$ cd $ES_HOME
$ vim config/elasticsearch.yml
cluster.name: es5-clustern
node.name: es-main
network.host: 0.0.0.0
http.port: 9200
bootstrap.memory_lock: true
bootstrap.system_call_filter: false
启动管理
$ cd $ES_HOME && bin/elasticsearch
$ cd $ES_HOME && bin/elasticsearch -d
$ tail -f logs/es5-cluster.log