CentOS7.9-ES7 部署
-
下载 https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.11.2-linux-x86_64.tar.gz
-
解压
tar -zxvf elasticsearch-7.11.2-linux-x86_64.tar.gz
-
移动目录
mv elasticsearch-7.11.2 /usr/local/
-
# vim config/elasticsearch.yml # 集群名 cluster.name: es-cluster # 节点名 node.name: node-master # 数据存放位置 path.data: /usr/local/elasticsearch-7.11.2/data # 日志存放位置 path.logs: /usr/local/elasticsearch-7.11.2/logs # bind 地址,0 表示任意 network.host: 0.0.0.0 # 默认初始 master 节点 cluster.initial_master_nodes: ["node-master"]
-
修改 jvm 相关配置
# 重点配置堆内存大小, 本人为虚拟机只给 512m,请结合实际情况调优 -xms512m -Xmx512m
-
useradd esuser chown -R esuser:esuser /usr/local/elasticsearch-7.11.2/
-
运行时可能出现以下错误
ERROR: [2] bootstrap checks Failed [1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65535] [2]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144] ERROR: Elasticsearch did not exit normally - check the logs at /usr/local/elasticsearch-7.11.2/logs/es-cluster.log
-
修改限制
vim /etc/security/limits.conf # 输入如下参数 * soft nofile 65536 * hard nofile 131072 * soft nproc 2048 * hard nproc 4096
-
修改系统设置
vim /etc/sysctl.conf vm.max_map_count=262145
sysctl -p
-
配置开机自启
vim /etc/init.d/elasticsearch
#!/bin/bash #chkconfig: 345 63 37 #description: elasticsearch #processname: elasticsearch-7.11.2 export ES_HOME=/usr/local/elasticsearch-7.11.2 case $1 in start) su esuser<<! cd $ES_HOME ./bin/elasticsearch -d -p pid exit ! echo "elasticsearch is started" ;; stop) pid=`cat $ES_HOME/pid` kill -9 $pid echo "elasticsearch is stopped" ;; restart) pid=`cat $ES_HOME/pid` kill -9 $pid echo "elasticsearch is stopped" sleep 1 su esuser<<! cd $ES_HOME ./bin/elasticsearch -d -p pid exit ! echo "elasticsearch is started" ;; *) echo "start|stop|restart" ;; esac exit 0
chmod 777 elasticsearch chkconfig --add elasticsearch chkconfig elasticsearch on
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。