How to disable/remove Elasticsearch?

In https://docs.zammad.org/en/latest/install-elasticsearch.html I don’t see how to disable, or better remove, Elasticsearch.

Using version:

zammad:
  Installed: 2.3.0-1518538476.8684b1e4.xenial
  Candidate: 2.3.0-1518538476.8684b1e4.xenial
  Version table:
 *** 2.3.0-1518538476.8684b1e4.xenial 500
        500 https://dl.packager.io/srv/deb/zammad/zammad/stable/ubuntu 16.04/main amd64 Packages
        100 /var/lib/dpkg/status
     2.3.0-1518189665.73199b9b.xenial 500
        500 https://dl.packager.io/srv/deb/zammad/zammad/stable/ubuntu 16.04/main amd64 Packages
[...]

First I check status:

systemctl status elasticsearch:
● elasticsearch.service - Elasticsearch
   Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; disabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Fri 2018-02-16 11:04:06 CET; 8min ago
     Docs: http://www.elastic.co
 Main PID: 1258 (code=exited, status=1/FAILURE)

Ok, it’s not running/fails to run (2GB RAM is not enough), so I want to disable it: systemctl disable elasticsearch

Then I check again:

systemctl status elasticsearch:
● elasticsearch.service - Elasticsearch
   Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; disabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Fri 2018-02-16 11:04:06 CET; 8min ago
     Docs: http://www.elastic.co
 Main PID: 1258 (code=exited, status=1/FAILURE)

Still tries to start.

You have to stop elasticsearch first.

systemctl stop elasticsearch

then you can disable it if you want.

If I run:

# systemctl stop elasticsearch
#
# systemctl disable elasticsearch
Synchronizing state of elasticsearch.service with SysV init with /lib/systemd/systemd-sysv-install...
Executing /lib/systemd/systemd-sysv-install disable elasticsearch
insserv: warning: current start runlevel(s) (empty) of script `elasticsearch' overrides LSB defaults (2 3 4 5).
insserv: warning: current stop runlevel(s) (0 1 2 3 4 5 6) of script `elasticsearch' overrides LSB defaults (0 1 6).
insserv: warning: current start runlevel(s) (empty) of script `elasticsearch' overrides LSB defaults (2 3 4 5).
insserv: warning: current stop runlevel(s) (0 1 2 3 4 5 6) of script `elasticsearch' overrides LSB defaults (0 1 6).
#
# systemctl status elasticsearch
● elasticsearch.service - Elasticsearch
   Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; disabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Fri 2018-02-16 11:04:06 CET; 34min ago
     Docs: http://www.elastic.co
 Main PID: 1258 (code=exited, status=1/FAILURE)
[...]

It unfortunately still is loaded.

I could try https://docs.zammad.org/en/latest/install-elasticsearch.html#ubuntu-16-04 in reverse. Hope Zammad will still work.

Ok, did:
# rm /etc/apt/sources.list.d/elastic-5.x.list
# apt-key list
# apt-key del D88E42B4
# apt remove elasticsearch

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libevent-core-2.0-5 libevent-extra-2.0-5
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
  elasticsearch zammad
0 upgraded, 0 newly installed, 2 to remove and 0 not upgraded.
After this operation, 297 MB disk space will be freed.
Do you want to continue? [Y/n] ^C

It shows that zammad as well will be removed:

How about

/etc/init.d/elasticsearch stop

Then check for the process

ps auxww |grep elasticsearch

and then remove elasticsearch from starting at startup

update-rc.d -f elasticsearch remove

# /etc/init.d/elasticsearch stop
[ ok ] Stopping elasticsearch (via systemctl): elasticsearch.service.
# ps auxww |grep elasticsearch
root 4750 0.0 0.0 12944 972 pts/0 S+ 12:07 0:00 grep --color=auto elasticsearch
# update-rc.d -f elasticsearch remove
But still loads:
# systemctl status elasticsearch
● elasticsearch.service - Elasticsearch
Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; disabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Fri 2018-02-16 11:04:06 CET; 1h 3min ago
Docs: http://www.elastic.co
Main PID: 1258 (code=exited, status=1/FAILURE)

I’m doing a reboot now and see if it starts.

After reboot it shows:
# systemctl status elasticsearch

● elasticsearch.service - Elasticsearch
Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; disabled; vendor preset: enabled)
Active: inactive (dead)
Docs: http://www.elastic.co

It’s now inactive but still loaded?

apt remove elasticsearch tries to remove zammad as well. Can I use dpkg -r --force-depends elasticsearch to remove only elasticsearch wihtout zammad and will Zammad run after this?

can you try disable ES in Zammad:
rails> Setting.set('es_url', '')

then:
systemctl disable elasticsearch

# zammad run rails r "Setting.set('es_url', '')" is what I’m already using. But I think I have to run it after each apt upgrade. I have just run the commands again and will look at it again and post if I have to run them after each apt upgrade.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.