Elasticsearch启动、停止脚本
构建Elasticsearch启动脚本 start_es.sh。
- #!/bin/bash
- export ES_HOME=xxx
- su elastic -c "sh ${ES_HOME}/bin/elasticsearch -d -p ${ES_HOME}/pid"
参数说明:
- su:登录用户。
- elastic:部署Elasticsearch用户,避免root用户而无法启动。
- c:c参数后跟具体命令。
- d:Elasticsearch作为守护线程后台启动。
- p:指定线程ID文件,需要新建。
构建Elasticsearch停止脚本 stop_es.sh。
- #!/bin/bash
- export ES_HOME=xxx
- kill `cat ${ES_HOME}/pid`
转载于:https://www.cnblogs.com/chloneda/p/es-shell.html