Set the Elasticsearch server address

Hi @Phillip,

it seems like you are connecting Elasticsearch to the port where your nginx runs… but it should point to:

zammad run rails r “Setting.set(‘es_url’, ‘http://my.sub.domain:9200’)”

instead… unless you have also modified the port for Elasticsearch…

HTH,
Martin

Unable to process GET request to elasticsearch URL 'https://my.sub.domain:9200'. Elasticsearch is not reachable, probably because it's not running or even installed.

I haven’t set anything with Elasticsearch or nynsx.
Do I need port forwarding in the router?

Can you check your elasticsearch.yml for the option http.port?

I set nothing there
#http.port: 9200

But, it worked with the settings before I installed SSL and made the zammad.conf settings.

this seems to be the default value, so it should be OK.

Please run the command I posted before, this should connect Zammad with Elasticsearch

Alternatively, you can install everything from scratch and use my installer script which would take care of everything for you :wink:

Provided that you stick to the officially supported Linux distributions there.

HTH
Martin

Geez you’re really advertising your installation script agressively.
The issue seems to be that @Phillip updates the elasticsearch URL alongside his FQDN for Zammad.

If your Elasticsearch installation is a local one and you didn’t change anything in that regard (let’s ignore the change from http to https for your Zammad installation), the correct Elasticsearch URL will be:
http://localhost:9200

You’ll need to reindex your searchindex as you proberbly have lost too much time for Zammad to rerun those failing indexes.

Does not sound good :frowning:
Here is the complete output if I set according to instructions

root@zammad:/etc/elasticsearch# zammad run rails r "Setting.set('es_url', 'http://localhost:9200')"
root@zammad:/etc/elasticsearch# zammad run rake searchindex:rebuild
rake aborted!
Unable to process GET request to elasticsearch URL 'http://localhost:9200'. Elasticsearch is not reachable, probably because it's not running or even installed.

Response:
#<UserAgent::Result:0x000055a97bfe4690 @success=false, @body=nil, @data=nil, @code=0, @content_type=nil, @error="#<Errno::ECONNREFUSED: Failed to open TCP connection to localhost:9200 (Connection refused - connect(2) for \"localhost\" port 9200)>">

Payload:
null

Payload size: 0M
/opt/zammad/lib/search_index_backend.rb:32:in `info'
/opt/zammad/lib/tasks/search_index_es.rake:333:in `es_version'
/opt/zammad/lib/tasks/search_index_es.rake:343:in `es_version_supported?'
/opt/zammad/lib/tasks/search_index_es.rake:182:in `block (2 levels) in <main>'
/opt/zammad/vendor/bundle/ruby/2.6.0/gems/rake-12.3.3/exe/rake:27:in `<top (required)>'
/opt/zammad/vendor/bundle/ruby/2.6.0/gems/bundler-1.17.3/lib/bundler/cli/exec.rb:74:in `load'
/opt/zammad/vendor/bundle/ruby/2.6.0/gems/bundler-1.17.3/lib/bundler/cli/exec.rb:74:in `kernel_load'
/opt/zammad/vendor/bundle/ruby/2.6.0/gems/bundler-1.17.3/lib/bundler/cli/exec.rb:28:in `run'
/opt/zammad/vendor/bundle/ruby/2.6.0/gems/bundler-1.17.3/lib/bundler/cli.rb:463:in `exec'
/opt/zammad/vendor/bundle/ruby/2.6.0/gems/bundler-1.17.3/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/opt/zammad/vendor/bundle/ruby/2.6.0/gems/bundler-1.17.3/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
/opt/zammad/vendor/bundle/ruby/2.6.0/gems/bundler-1.17.3/lib/bundler/vendor/thor/lib/thor.rb:387:in `dispatch'
/opt/zammad/vendor/bundle/ruby/2.6.0/gems/bundler-1.17.3/lib/bundler/cli.rb:27:in `dispatch'
/opt/zammad/vendor/bundle/ruby/2.6.0/gems/bundler-1.17.3/lib/bundler/vendor/thor/lib/thor/base.rb:466:in `start'
/opt/zammad/vendor/bundle/ruby/2.6.0/gems/bundler-1.17.3/lib/bundler/cli.rb:18:in `start'
/opt/zammad/vendor/bundle/ruby/2.6.0/gems/bundler-1.17.3/exe/bundle:30:in `block in <top (required)>'
/opt/zammad/vendor/bundle/ruby/2.6.0/gems/bundler-1.17.3/lib/bundler/friendly_errors.rb:124:in `with_friendly_errors'
/opt/zammad/vendor/bundle/ruby/2.6.0/gems/bundler-1.17.3/exe/bundle:22:in `<top (required)>'
bin/bundle:3:in `load'
bin/bundle:3:in `<main>'
Tasks: TOP => searchindex:rebuild => searchindex:version_supported
(See full trace by running task with --trace)

Your Elasticsearch is local AND running?

ss -tulpen| grep "9200" should provide at least two lines, one for your elasticsearch.

The documentation states to start and enable elasticsearch after installation:

systemctl restart elasticsearch
systemctl enable elasticsearch

Ensure ES is running and that you fullfilled all required steps.
If you updated Elasticsearch without Zammad, ensure to install the new ingest-plugin.
This step is required with every ES update.

If all that does not help, provide your elasticsearch logfiles.

hmm…

Please run:

rpm -qa | grep elasticsearch

if it is installed, you should start it:

systemctl enable --now elasticsearch <-- this will start the service even after server reboots

Everything runs locally, unless you are using an external server for Elasticsearch, so nothing needs to be modified in the router.

@MrGeneration it’s not advertising, but rather an advice.
I offered the script to the Zammad Community in order to assist fellow SysAdmins of all levels.
If suggesting people a tool that could make their life a bit easier is not encouraged here, fear not. I will not “advertise” anything else :slight_smile:

Peace out.

Timeout:

root@zammad:/etc/elasticsearch# rpm -qa | grep elasticsearch

root@zammad:/etc/elasticsearch# systemctl enable --now elasticsearch
Synchronizing state of elasticsearch.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable elasticsearch
Job for elasticsearch.service failed because a timeout was exceeded.
See "systemctl status elasticsearch.service" and "journalctl -xe" for details.

root@zammad:/etc/elasticsearch# systemctl status elasticsearch.service
● elasticsearch.service - Elasticsearch
     Loaded: loaded (/lib/systemd/system/elasticsearch.service; enabled; vendor preset: enabled)
     Active: failed (Result: timeout) since Thu 2020-11-19 13:18:41 UTC; 15min ago
       Docs: https://www.elastic.co
   Main PID: 8483 (code=exited, status=143)

Elasticsearch is no running:
Here is my solution: https://blog.sleeplessbeastie.eu/2020/02/29/how-to-prevent-systemd-service-start-operation-from-timing-out/

@rsysadmin it’s okay, I just noticed that you also tell about these scripts if the system is already installed. That’s all :wink:

@Phillip to me your solution sounds like a workaround for other issues.
I don’t know anything about the specs of your system, but if your elasticsearch already takes ages to startup, you’ll likely run into performance issues sooner or later.

Another question.
I restarted the Ubuntu server. Now the index has been updated more.

Elasticsearch was active, but I had to run the command first to get everything working again.
zammad run rake searchindex:rebuild

Is that normal and can it be automated?

WTH?? the command above shows that you do not have ES installed…

Which OS are you using? Maybe the package is called something else there…

In case it helps anyone: That error also occurs when there is not enough RAM available (and Elasticsearch didn’t start because of this).

I installed Zammad on a virtual server with 2 GB RAM (here they mention that as a min., and why not try it: How to Install and Configure Zammad Ticketing System on Ubuntu |).

After letting Certbot change my Apache configuration I thought that may have messed up the http connection to Elasticsearch.
This helped to think about the RAM:

After rescaling the Server to 4 GB RAM it worked to start and connect Elasticsearch.

@MrGeneration
It may sound stupid, but maybe you could add a warning to the documentation (Set up Elasticsearch — Zammad System Documentation documentation) that Elasticsearch really needs 4 GB RAM to even start. Cause the error messages don’t mention the RAM problem. And people who just want to set up a test machine may try it with the smallest/cheapest virtual server.

ES can run fine with less ram. I’m currently (stably) running ES on it’s own dedicated VPS (t2.micro) with 1 gig of ram. Just need to tweak the settings.

/etc/elasticsearch/jvm.options

-Xms256m
-Xmx256m

Thanks for the suggestion, but I can’t get it running on a 2 GB virtual Server.

in my /etc/elasticsearch/jvm.options the xms/xmx Settings are commented out, I suppose a default of 4 GB is taken anyway:

As written there I created a configuration file in /etc/elasticsearch/jvm.options.d/ where I added the 2 lines
-Xms256m
-Xmx256m

When I restart ES with
systemctl restart elasticsearch

it loads the CPU with 100% and fills the RAM completely - that takes 1-2 minutes, then it aborts with the message:

Job for elasticsearch.service failed because a timeout was exceeded.
See “systemctl status elasticsearch.service” and “journalctl -xe” for details.

Thats exactly the same problem I had when I first tried to start Elasticsearch on a server with 2 GB RAM. Scaling the Server up to 4 GB RAM solved the problem.

This indicates I/O issues on your machine.
Elasticsearch gives up trying to start after 2 minutes.

I’ve seen this in heavy I/O situations. I’m afraid this is nothing we can help you with exactly.

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