ELKF之elasticsearch安装配置

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]
# vim /etc/security/limits.conf   #追加如下,sim为用户名,同时确保用户有此命令权限
sim soft nofile 65536
sim hard nofile 65536

$ cd $ES_HOME && vim bin/elasticsearch  #sim用户修改启动脚本,启动时可打印max file descriptors
-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
  • limitss.conf生效
# 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
  • 防火墙配置
# vi /etc/sysconfig/iptables  #添加如下
-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
# service iptables restart

配置环境变量

  • 配置全局
# vim /etc/profile.d/elasticsearch.sh  #追加如下
export ES_HOME=/home/sim/elasticsearch-5.5.0
export PATH=$ES_HOME/bin:$PATH

#. /etc/profile
#. /etc/bashrc
# echo $ES_HOME
  • 配置当前用户
$ vim ~/.bash_profile  #追加如下
export ES_HOME=~/elasticsearch-5.5.0
export PATH=$ES_HOME/bin:$PATH
$ source ~/.bash_profile
# echo $ES_HOME

配置

$ 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
阅读更多
文章标签: elasticsearch
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭