ElasticSearch(十四):Linux下设置ElasticSearch 开机自启
一、创建脚本文件
在 /etc/init.d 目录下,创建脚本文件 elasticsearch
# cd /etc/init.d/
# vim elasticsearch
将以下内容写入文件中(其中JDK安装路径、elasticsearch安装路径及用于启动的elasticsearch的用户根据实际情况进行修改)
#!/bin/sh
#chkconfig:
#description: elasticsearch export JAVA_HOME=/usr/local/java/jdk1..0_171
export JAVA_BIN=/usr/local/java/jdk1..0_171/bin
export PATH=$PATH:$JAVA_HOME/bin
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export JAVA_HOME JAVA_BIN PATH CLASSPATH case "$1" in
start)
su - es<<!
cd /usr/local/elasticsearch-6.8.
./bin/elasticsearch -d
!
echo "elasticsearch startup"
;;
stop)
es_pid=`ps aux|grep elasticsearch | grep -v 'grep elasticsearch' | awk '{print $2}'`
kill - $es_pid
echo "elasticsearch stopped"
;;
restart)
es_pid=`ps aux|grep elasticsearch | grep -v 'grep elasticsearch' | awk '{print $2}'`
kill - $es_pid
echo "elasticsearch stopped"
su - es<<!
cd /usr/local/elasticsearch-6.8.
./bin/elasticsearch -d
!
echo "elasticsearch startup"
;;
*)
echo "start|stop|restart"
;;
esac exit $?
保存退出
二、设置开机自启
在 /etc/init.d 目录下赋予新创建的elasticsearch文件执行权限
# chmod +x elasticsearch
添加到开机启动任务
# chkconfig --add elasticsearch
重启机器,检测elasticsearch是否自启
# ps -ef|grep elasticsearch

elasticsearch进程已经起来
检测elasticsearch服务是否正常
# curl http://192.168.56.13:9200

服务正常,至此Linux下设置Elasticsearch开机自启完成!
ElasticSearch(十四):Linux下设置ElasticSearch 开机自启的更多相关文章
- Linux下设置Nginx开机自启
1.本地环境 [root@dev ~]#cat /etc/redhat-release CentOS Linux release 7.5.1804 (Core) 2.在/etc/init.d创建ngi ...
- linux 上设置mysql开机自启
此方式是通过安装包安装的,如果是yum安装的rpm包,可参考yum安装MySQL8.0 三个月之前安装的mysql,记得是设置了开机自启,但是今天再次进入的时候发现,无法登录,报错如下 原因是mysq ...
- Nginx知多少系列之(十四)Linux下.NET Core项目Nginx+Keepalived高可用(主从模式)
目录 1.前言 2.安装 3.配置文件详解 4.工作原理 5.Linux下托管.NET Core项目 6.Linux下.NET Core项目负载均衡 7.负载均衡策略 8.加权轮询(round rob ...
- Linux下设置svn开机自启动
方式一:centos 7 设置svn开机自启动 使用新的systemctl 服务命令 (笔者成功验证过,该方式可行) [root@iZjvr37lpviqbkZ init.d]# vi /lib/s ...
- Linux下设置Tomcat开机自启动
--未验证 第一步:在/etc/init.d下新建一个文件tomcat(需要root操作权限) vi /etc/init.d/tomcat 然后点击"i"写下如下代码,tomcat ...
- Linux下设置Tomcat开机启动
1.进入/etc/rc.d/init.d,新建文件tomcat,并让它成为可执行文件 chmod 755 tomcat. #!/bin/bash # # /etc/rc.d/init.d/tomcat ...
- 记录Linux下安装elasticSearch时遇到的一些错误
记录Linux下安装elasticSearch时遇到的一些错误 http://blog.sina.com.cn/s/blog_c90ce4e001032f7w.html (2016-11-02 22: ...
- linux下安装Elasticsearch(单机版和集群版)
一.linux下安装Elasticsearch(单机) 1.软件下载 下载地址:https://www.elastic.co/cn/downloads/past-releases/elasticsea ...
- Ubuntu Linux下设置IP的配置命令
Ubuntu Linux下设置IP的配置命令 今天装了Ubuntu,但是发现不能上网,开始排查问题: 1.首先确定网络连接是否正确,所用的网线是否可以正常工作 2.查看网卡是否能正常工作,检测的方法如 ...
随机推荐
- 关于很狗的军训qwq
我该用哪种方式来证明我存在过 说起这个很狗的军训呀,,, 军训嘛 就不得不先说最基本的,,, 那就是很狗的衣服,,, 一套军装,+一个帽子+一双特别特别特别硌脚的胶鞋!!! 然后... 我胖了..q ...
- 洛谷P2341 [HAOI2006]受欢迎的牛|【模板】强连通分量
https://www.luogu.org/problem/P2341 缩点之后唯一 一个出度为0的点 #include<cstdio> #include<iostream> ...
- iptables 常用命令解析
查看当前iptables规则: iptables -n -L --line-numbers该命令会以列表的形式显示出当前使用的 iptables 规则,并不做解析,每一条规则前面的编号可以用来做为其它 ...
- curl用法详解
前言 昨天现场的浏览器崩溃了,楼主苦逼,就临时用了curl测试了下图片请求接口.今天总结下. 一.what? curl is a tool to transfer data from or to a ...
- java基础 static
参考文章: 静态导包:https://blog.csdn.net/u012338954/article/details/51010337 常量池:http://blog.sina.com.cn/s/b ...
- Expect Command And How To Automate Shell Scripts Like Magic
In the previous post, we talked about writing practical shell scripts and we saw how it is easy to w ...
- CentOS 7下JumpServer安装及配置
环境 系统 # cat /etc/redhat-release CentOS Linux release 7.4.1708 (Core) # uname -r 3.10.0-693.21.1.el7. ...
- 029 ElasticSearch----全文检索技术04---基础知识详解02-查询
1.查询 (1)基本查询 基本语法: GET /索引库名/_search { "query":{ "查询类型":{ "查询条件":" ...
- Django 路由正则URL
Django 路由正则URL URL1 # 路由 url(r'^detail/', views.detail) {#点击跳转到指定用户下显示信息#} <li><a target=&q ...
- css z-index 的学习
前言:这是笔者第一次写博客,主要是学习之后自己的理解.如果有错误或者疑问的地方,请大家指正,我会持续更新! z-index属性描述元素的堆叠顺序(层级),意思是 A 元素可以覆盖 B 元素,但是 B ...