centos7.5安装elasticsearch7
/usr/local下上传包
elasticsearch-7.3.0-linux-x86_64.tar
tar -zxvf xxxx
mv elasticsearch-7.3.0 elasticsearch
useradd es
passwd es
chown -R es elasticsearch-7.3.0
vim config/elasticsearch.yml
cluster.name: my-application
node.name: node-1
path.data: /usr/local/elasticsearch/data
path.logs: /usr/local/elasticsearch/logs
network.host: 0.0.0.0
http.port: 9200
cluster.initial_master_nodes: ["node-1", "node-2"]
vim jvm.options

vim /etc/security/limits.conf
* soft nofile 65536 * hard nofile 65536
* soft nproc 4096 * hard nproc 4096
vi /etc/sysctl.conf
vm.max_map_count=262144
sysctl -p
用es用户启动
chmod 777 config/elasticsearch.keystore
开机自启脚本
#!/bin/sh
#chkconfig: 2345 80 05
#description: elasticsearch
export JAVA_HOME=/env/jdk-11.0.11
export JRE_HOME=${JAVA_HOME}/jre
export PATH=PATH:${JAVA_HOME}/bin:$PATH
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
case "$1" in
start)
su elk<<!
cd /usr/local/elasticsearch
./bin/elasticsearch -d
!
echo "elasticsearch startup"
;;
stop)
es_pid=`ps aux|grep elasticsearch | grep -v 'grep elasticsearch' | awk '{print $2}'`
kill -9 $es_pid
echo "elasticsearch stopped"
;;
restart)
es_pid=`ps aux|grep elasticsearch | grep -v 'grep elasticsearch' | awk '{print $2}'`
kill -9 $es_pid
echo "elasticsearch stopped"
su elk<<!
cd /usr/local/elasticsearch
./bin/elasticsearch -d
!
echo "elasticsearch startup"
;;
*)
echo "start|stop|restart"
;;
esac
exit $?
chmod +x elasticsearch
chkconfig --add elasticsearch

浙公网安备 33010602011771号