Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove Elasticsearch from Ubuntu?

I think that I already removed elasticsearch from my computer, and still I have some doubts.

When I type:

$ service elasticsearch status

I get:

elasticsearch.service Loaded: not-found (Reason: No such file or directory) Active: failed (Result: exit-code) since Wed 2017-08-09 01:08:18 PDT; 38min ago Main PID: 73249 (code=exited, status=1/FAILURE)

Aug 09 01:08:18 ubuntu elasticsearch[73249]: Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x0000000085330000, 2060255232, 0) fai Aug 09 01:08:18 ubuntu elasticsearch[73249]: # Aug 09 01:08:18 ubuntu elasticsearch[73249]: # There is insufficient memory for the Java Runtime Environment to continue. Aug 09 01:08:18 ubuntu elasticsearch[73249]: # Native memory allocation (mmap) failed to map 2060255232 bytes for committing reserved memory. Aug 09 01:08:18 ubuntu elasticsearch[73249]: # An error report file with more information is saved as: Aug 09 01:08:18 ubuntu elasticsearch[73249]:

/tmp/hs_err_pid73249.log Aug 09 01:08:18 ubuntu systemd[1]: elasticsearch.service: Main process exited, code=exited,

status=1/FAILURE Aug 09 01:08:18 ubuntu systemd[1]: elasticsearch.service: Unit entered failed state. Aug 09 01:08:18 ubuntu systemd[1]: elasticsearch.service: Failed with result 'exit-code'. Aug 09 01:12:38 ubuntu systemd[1]: Stopped Elasticsearch.

However, when I type:

$ service helloworld status 

I get somehting much shorter:

helloworld.service Loaded: not-found (Reason: No such file or

directory) Active: inactive (dead)

I already removed Elasticsearch by using the command:

sudo apt-get --purge autoremove elasticsearch

and it still looks like elasticsearch exists.

like image 489
CrazySynthax Avatar asked Aug 09 '17 08:08

CrazySynthax


People also ask

How do I completely remove Elasticsearch from Ubuntu?

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.

How do I uninstall Elasticsearch x64?

To do this, first open the Control Panel and then go to Programs and Features. Find Elasticsearch in the list of installed programs and click on it. Then, click the Uninstall button.


2 Answers

On ubuntu 20.04, I had a similar problem: I wanted to totally remove elasticsearch 7.15.1 and install the previous version 7.10.1.

I ran:

sudo apt-get remove --purge elasticsearch

The message was:

dpkg: warning: while removing elasticsearch, directory '/var/lib/elasticsearch' not empty so not removed
dpkg: warning: while removing elasticsearch, directory '/etc/elasticsearch' not empty so not removed

So I removed those directories:

sudo rm -rf /etc/elasticsearch
sudo rm -rf /var/lib/elasticsearch

And I was able to downgrade without any errors:

sudo apt-get install elasticsearch=7.10.1
sudo systemctl start elasticsearch
curl http://localhost:9200/
like image 140
grzegorzs Avatar answered Oct 09 '22 09:10

grzegorzs


for uninstall deb package you can use:

dpkg --purge elasticsearch

or

apt-get --purge autoremove elasticsearch

you can find all elasticsearch related folders with locate elasticsearch but before that use updatedb command.

# updatedb

# locate elasticsearch

I will list all default elasticsearch path for more information.

configurations files:

/etc/elasticsearch/
/etc/default/elasticsearch

base path(bins and libs and ...):

/usr/share/elasticsearch/

data path (can be configured in /etc/elasticsearch/elasticsearch.yml):

/var/lib/elasticsearch

log path (can be configured in /etc/elasticsearch/elasticsearch.yml):

/var/log/elasticsearch/

service files:

/etc/init.d/elasticsearch
/etc/systemd/system/multi-user.target.wants/elasticsearch.service
/usr/lib/systemd/system/elasticsearch.service
like image 41
hamid bayat Avatar answered Oct 09 '22 10:10

hamid bayat