elasticsearch启动脚本

Posted share-wu

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了elasticsearch启动脚本相关的知识,希望对你有一定的参考价值。

#!/bin/sh
#chkconfig: 2345 80 05
#description: elasticsearch

export JAVA_HOME=/usr/local/java
export JRE_HOME=/usr/local/java/jre
export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH


case "$1" in
start)
su elasticsearch<<!
cd /opt/elasticsearch-6.3.2
./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 elasticsearch<<!
cd /opt/elasticsearch-6.3.2
./bin/elasticsearch -d
!
echo "elasticsearch startup"
;;
*)
echo "start|stop|restart"
;;
esac

exit $?

































以上是关于elasticsearch启动脚本的主要内容,如果未能解决你的问题,请参考以下文章

Elasticsearch---spring-boot-starter-data-elasticsearch整合攻略详解

SpringBoot集成ElasticSearch 02使用 spring-boot-starter-data-elasticsearch 集成并使用高级客户端

spring整合Elasticsearch

linux12Elk -->02elasticsearch部署

kibana安装

SpringBoot2.X整合elasticsearch'