OS:CentOS release 6.9
1 ES获取
elasticsearch-7.2.1-linux-x86_64.tar.gz
curl -L -O https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.2.1-linux-x86_64.tar.gz
2 OS配置
ulimit -n
vi /etc/security/limits.conf
-------------打开最大文件数------------------------
* soft nproc 65535
* hard nproc 65535
* soft nofile 65535
* hard nofile 65535
vi /etc/sysctl.conf
------------添加内容------------------------
vm.max_map_count=262144
sysctl -p
3 elasticsearch.yml
/app/elasticsearch/config/elasticsearch.yml
1】节点192.168.1.31
cluster.name: elk-es
node.name: node-01
network.host: 192.168.1.31
discovery.seed_hosts: ["192.168.1.31", "192.168.1.32", "192.168.1.33"]
cluster.initial_master_nodes: ["node-01","node-02","node-03"]
bootstrap.system_call_filter: false
2】节点192.168.1.32
cluster.name: elk-es
node.name: node-02
network.host: 192.168.1.32
discovery.seed_hosts: ["192.168.1.31", "192.168.1.32", "192.168.1.33"]
cluster.initial_master_nodes: ["node-01","node-02","node-03"]
bootstrap.system_call_filter: false
3】节点192.168.1.33
cluster.name: elk-es
node.name: node-03
network.host: 192.168.1.33
discovery.seed_hosts: ["192.168.1.31", "192.168.1.32", "192.168.1.33"]
cluster.initial_master_nodes: ["node-01","node-02","node-03"]
bootstrap.system_call_filter: false
4 jvm.options
/app/elasticsearch/config/jvm.options
-Xms30g
-Xmx30g
#-XX:+UseConcMarkSweepGC
-XX:+UseG1GC
5 JDK环境变量
vi /app/elasticsearch/bin/elasticsearch
---------------添加内容---------------------
export JAVA_HOME=/app/elasticsearch/jdk
export PATH=$JAVA_HOME/bin:$PATH
6 启动关闭
cd /app/elasticsearch/bin
# 启动
./elasticsearch -d
# 关闭
ps -ef|grep elasticsearch|awk '{print $2}'|xargs kill -9
7 集群健康检查
curl -XGET "http://10.110.39.241:9200/_cluster/health"
curl -XGET "http://10.110.39.241:9200/_cat/health?v"
curl -XGET "http://10.110.39.241:9200/?pretty"
8 日志索引清除
delete_es_index.sh
#/bin/bash
#es-index-clear
#只保留7天内的日志索引
LAST_DATA=`date -d "-8 days" "+%Y.%m.%d"`
curl -XDELETE 'http://10.119.97.210:9200/*-'${LAST_DATA}'*'