多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
很多人学习elasticSearch都是自学,想百度一下如何重启es也是没有答案,我硬着头皮,算是琢磨出来了,借此写博,希望能帮助您。 ## 1.如何关闭ES,elasticsearch关闭办法 ### 1.使用head插件 ### 找到想关掉的节点进行关停 ![](https://img.kancloud.cn/be/6a/be6a8546c7afcf7eda5bdf1d9f0e1f8d_536x312.png) ### 2.使用命令kill杀掉服务器的ES进程即可 #### 1.查找ES进程 `ps -ef | grep elastic` #### 2.杀掉ES进程 `kill -9 2382(进程号)` #### 3.重启ES `sh elasticsearch -d` ## 2.如何重启ES 没有重启的办法,只有参考上面`关闭->开启`这样。 ### 以下是详细的操作过程 #### 1.首先是查找服务器是否有ES进程,无果ES没有开启,也就不用关闭了,如果开启,则杀死进程就行 ##### 1.查找进程命令 ps -ef | grep elastic ~~~bash [root@bjdhj-125-203 _site]# ps -ef | grep elastic //然后可以看到如下的进程号,2382,2583之类的,之后kill掉就可以啦。 root 2382 1 0 Jan05 ? 00:10:57 /opt/soft/jdk/jdk1.7.0_80/bin/java -Xms2g -Xmx2g -Djava.awt.headless=true -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+HeapDumpOnOutOfMemoryError -XX:+DisableExplicitGC -Dfile.encoding=UTF-8 -Delasticsearch -Des.path.home=/opt/soft/elasticsearch-1.5.2-2 -cp :/opt/soft/elasticsearch-1.5.2-2/lib/elasticsearch-1.5.2.jar:/opt/soft/elasticsearch-1.5.2-2/lib/*:/opt/soft/elasticsearch-1.5.2-2/lib/sigar/* org.elasticsearch.bootstrap.Elasticsearch root 2583 1 0 Jan05 ? 00:10:24 /opt/soft/jdk/jdk1.7.0_80/bin/java -Xms2g -Xmx2g -Djava.awt.headless=true -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+HeapDumpOnOutOfMemoryError -XX:+DisableExplicitGC -Dfile.encoding=UTF-8 -Delasticsearch -Des.path.home=/opt/soft/elasticsearch-1.5.2 -cp :/opt/soft/elasticsearch-1.5.2/lib/elasticsearch-1.5.2.jar:/opt/soft/elasticsearch-1.5.2/lib/*:/opt/soft/elasticsearch-1.5.2/lib/sigar/* org.elasticsearch.bootstrap.Elasticsearch root 8682 8564 0 18:04 pts/0 00:00:00 grep elastic ~~~ ##### 2.杀掉进程 kill -9 2382(进程号) ~~~bash //杀掉杀掉统统杀掉,如果不确定进程号,可以看看上面信息里面的进程路径地址,防止杀错 [root@bjdhj-125-203 _site]# kill -9 2382 [root@bjdhj-125-203 _site]# ps -ef | grep elastic root 2583 1 0 Jan05 ? 00:10:24 /opt/soft/jdk/jdk1.7.0_80/bin/java -Xms2g -Xmx2g -Djava.awt.headless=true -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+HeapDumpOnOutOfMemoryError -XX:+DisableExplicitGC -Dfile.encoding=UTF-8 -Delasticsearch -Des.path.home=/opt/soft/elasticsearch-1.5.2 -cp :/opt/soft/elasticsearch-1.5.2/lib/elasticsearch-1.5.2.jar:/opt/soft/elasticsearch-1.5.2/lib/*:/opt/soft/elasticsearch-1.5.2/lib/sigar/* org.elasticsearch.bootstrap.Elasticsearch root 8684 8564 0 18:05 pts/0 00:00:00 grep elastic ~~~ ##### 3.重启命令 sh elasticsearch -d ~~~bash [root@bjdhj-125-203 elasticsearch-1.5.2]# ls bin config data lib LICENSE.txt logs NOTICE.txt plugins README.textile [root@bjdhj-125-203 elasticsearch-1.5.2]# cd bin [root@bjdhj-125-203 bin]# ./elasticsearch -d -bash: ./elasticsearch: Permission denied [root@bjdhj-125-203 bin]# sh elasticsearch -d link /opt/soft/jdk/jdk1.7.0_80 to /opt/soft/java User=root SourceJDKFileBase=10.126.103.198 JDKBasePath=/opt/soft/jdk Timeout=2 DefaultVer=jdk1.6.0_45 CurrentVer=jdk1.7.0_80 Initialize jdk(jdk1.7.0_80) done Current jdk version = 1.7.0_80 [root@bjdhj-125-203 bin]# ps -ef | grep elastic ~~~