Uninstalling Elasticsearch

1.Run the rpm -qa|grep elasticsearch command to check whether Elasticsearch exists on this server.

[[email protected] ~]# rpm -qa|grep elasticsearch
elasticsearch-oss-6.6.0-1.noarch

2.If it exists, complete the following steps to uninstall it:

1)Run the cd /usr/lib/netbrain/installer/elasticsearch command to navigate to the elasticsearch directory.

2)Run the ./uninstall.sh command under the elasticsearch directory.

3)Specify whether to remove all Elasticsearch data. To remove data, type y or yes, otherwise, type n or no.

[[email protected] ~]# cd /usr/lib/netbrain/installer/elasticsearch
[[email protected] elasticsearch]# ./uninstall.sh
Starting to uninstall Elasticsearch ...
Do you want to remove the data/log/config after uninstall the Elasticsearch component?
Input yes|y if you want to remove all related data : y
Stopping elasticsearch service... OK
warning: file /var/run/elasticsearch: remove failed: No such file or directory
warning: /usr/lib/systemd/system/elasticsearch.service saved as /usr/lib/systemd/system/elasticsearch.service.rpmsave
warning: /etc/sysconfig/elasticsearch saved as /etc/sysconfig/elasticsearch.rpmsave
warning: /etc/elasticsearch/log4j2.properties saved as /etc/elasticsearch/log4j2.properties.rpmsave
warning: /etc/elasticsearch/jvm.options saved as /etc/elasticsearch/jvm.options.rpmsave
warning: /etc/elasticsearch/elasticsearch.yml saved as /etc/elasticsearch/elasticsearch.yml.rpmsave
Deleting log directory... OK
Deleting plugins directory... OK
Removing /var/log/elasticsearch SUCCEEDED.
Removing /var/lib/elasticsearch SUCCEEDED.
Removing /etc/elasticsearch SUCCEEDED.
Removing /etc/init.d/elasticsearch SUCCEEDED.
Removing /usr/share/elasticsearch SUCCEEDED.
Successfully uninstalled Elasticsearch.