elasticsearch命令

Posted 07H_JH

tags:

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

1.如何关闭ES,elasticsearch关闭办法

1.使用head插件

找到想关掉的节点进行关停

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

[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(进程号)

//杀掉杀掉统统杀掉,如果不确定进程号,可以看看上面信息里面的进程路径地址,防止杀错
[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

[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

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

ElasticSearch常用命令

elasticsearch 相关命令

Elasticsearch 基础 DSL 命令

ElasticSearch5.5.2常用命令

Elasticsearch集群重启及滚动升级步骤和官网命令改进

elasticsearch命令