Failed to rebuild elastic index after moving service to another host

Infos:

Important:
If you are a Zammad Support or hosted customer and experience a technical issue, please refer to: support@zammad.com using your zammad-hostname / or company contract.

  • Used Zammad version: 2.6.x
  • Used Zammad installation source: package
  • Operating system: Debian GNU/Linux 9
  • Browser + version: Chrome latest
  • Elasticsearch: 5.6.12

Expected behavior:

Actual behavior:

Unable to process PUT request to elasticsearch URL 'http://elasticsearch/zammad_production'. Check the response and payload for detailed information:

And more

Response: #<UserAgent::Result:0x0000559713bee4c0 @success=false, @body=nil, @data=nil, @code=0, @content_type=nil, @error="#<RuntimeError: Unable to process http call '#<Net::HTTPBadGateway 502 Bad Gateway readbody=true>'>">`

Steps to reproduce the behavior:

  • I installed elasticsearch on a new server and configured it to be accessible through a reverse proxy with basic auth as suggested by documentation. I double checked the installation of ingest-attachment plugin on new server:
root@elastic:~# /usr/share/elasticsearch/bin/elasticsearch-plugin list
ingest-attachment
root@elastic:~#
  • I can access it from the zammad server using defined credentials:
root@zammad:~# wget --user **** --password **** http://elasticsearch 
--2018-10-16 01:05:31--  http://elasticsearch/
Resolving elasticsearch (elasticsearch)... 10.10.10.10
Connecting to elasticsearch (elasticsearch)|10.10.10.10|:80... connected.
HTTP request sent, awaiting response... 401 Unauthorized
Authentication selected: Basic realm="Elasticsearch"
Reusing existing connection to elasticsearch:80.
HTTP request sent, awaiting response... 200 OK
Length: 328 [application/json]
Saving to: ‘index.html’

index.html                                               100%[=================================================================================================================================>]     328  --.-KB/s    in 0s      

2018-10-16 01:05:31 (68.9 MB/s) - ‘index.html’ saved [328/328]

root@zammad:~# cat index.html

{
  "name" : "aWbkYdn",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "CimSqvNkShyjoyH9_d4fQQ",
  "version" : {
    "number" : "5.6.12",
    "build_hash" : "cfe3d9f",
    "build_date" : "2018-09-10T20:12:43.732Z",
    "build_snapshot" : false,
    "lucene_version" : "6.6.1"
  },
  "tagline" : "You Know, for Search"
}
  • I issued the commands below according to documentation
zammad run rails r "Setting.set('es_url', 'http://elasticsearch')"
zammad run rails r "Setting.set('es_user', '****')"
zammad run rails r "Setting.set('es_password', '****')"
zammad run rails r "Setting.set('es_index', 'zammad')"
zammad run rails r "Setting.set('es_attachment_ignore', [ '.png', '.jpg', '.jpeg', '.mpeg', '.mpg', '.mov', '.bin', '.exe', '.box', '.mbox' ] )"
zammad run rails r "Setting.set('es_attachment_max_size_in_mb', 50)"

And then, tried to rebuild index:

root@zammad:~# zammad run rake searchindex:rebuild

This is the same issue listed here "Unable to process PUT" to create ElasticSearch index with remote ElasticSearch

Any help would be great!

Thank you!
Matias

This is the trace of zammad run rake searchindex:rebuild --trace:

root@zammad:~# zammad run rake searchindex:rebuild --trace:
Payload size: 0M
/opt/zammad/lib/search_index_backend.rb:188:in `index'
/opt/zammad/lib/tasks/search_index_es.rake:33:in `block (2 levels) in <top (required)>'
/opt/zammad/vendor/bundle/ruby/2.4.0/gems/rake-12.3.1/lib/rake/task.rb:271:in `block in execute'
/opt/zammad/vendor/bundle/ruby/2.4.0/gems/rake-12.3.1/lib/rake/task.rb:271:in `each'
/opt/zammad/vendor/bundle/ruby/2.4.0/gems/rake-12.3.1/lib/rake/task.rb:271:in `execute'
/opt/zammad/lib/tasks/search_index_es.rake:142:in `block (2 levels) in <top (required)>'
/opt/zammad/vendor/bundle/ruby/2.4.0/gems/rake-12.3.1/lib/rake/task.rb:271:in `block in execute'
/opt/zammad/vendor/bundle/ruby/2.4.0/gems/rake-12.3.1/lib/rake/task.rb:271:in `each'
/opt/zammad/vendor/bundle/ruby/2.4.0/gems/rake-12.3.1/lib/rake/task.rb:271:in `execute'
/opt/zammad/vendor/bundle/ruby/2.4.0/gems/rake-12.3.1/lib/rake/task.rb:213:in `block in invoke_with_call_chain'
/opt/zammad/vendor/ruby-2.4.4/lib/ruby/2.4.0/monitor.rb:214:in `mon_synchronize'
/opt/zammad/vendor/bundle/ruby/2.4.0/gems/rake-12.3.1/lib/rake/task.rb:193:in `invoke_with_call_chain'
/opt/zammad/vendor/bundle/ruby/2.4.0/gems/rake-12.3.1/lib/rake/task.rb:182:in `invoke'
/opt/zammad/vendor/bundle/ruby/2.4.0/gems/rake-12.3.1/lib/rake/application.rb:160:in `invoke_task'
/opt/zammad/vendor/bundle/ruby/2.4.0/gems/rake-12.3.1/lib/rake/application.rb:116:in `block (2 levels) in top_level'
/opt/zammad/vendor/bundle/ruby/2.4.0/gems/rake-12.3.1/lib/rake/application.rb:116:in `each'
/opt/zammad/vendor/bundle/ruby/2.4.0/gems/rake-12.3.1/lib/rake/application.rb:116:in `block in top_level'
/opt/zammad/vendor/bundle/ruby/2.4.0/gems/rake-12.3.1/lib/rake/application.rb:125:in `run_with_threads'
/opt/zammad/vendor/bundle/ruby/2.4.0/gems/rake-12.3.1/lib/rake/application.rb:110:in `top_level'
/opt/zammad/vendor/bundle/ruby/2.4.0/gems/rake-12.3.1/lib/rake/application.rb:83:in `block in run'
/opt/zammad/vendor/bundle/ruby/2.4.0/gems/rake-12.3.1/lib/rake/application.rb:186:in `standard_exception_handling'
/opt/zammad/vendor/bundle/ruby/2.4.0/gems/rake-12.3.1/lib/rake/application.rb:80:in `run'
/opt/zammad/vendor/bundle/ruby/2.4.0/gems/rake-12.3.1/exe/rake:27:in `<top (required)>'
/opt/zammad/vendor/bundle/ruby/2.4.0/bin/rake:23:in `load'
/opt/zammad/vendor/bundle/ruby/2.4.0/bin/rake:23:in `<top (required)>'
/opt/zammad/vendor/bundle/ruby/2.4.0/gems/bundler-1.15.2/lib/bundler/cli/exec.rb:74:in `load'
/opt/zammad/vendor/bundle/ruby/2.4.0/gems/bundler-1.15.2/lib/bundler/cli/exec.rb:74:in `kernel_load'
/opt/zammad/vendor/bundle/ruby/2.4.0/gems/bundler-1.15.2/lib/bundler/cli/exec.rb:27:in `run'
/opt/zammad/vendor/bundle/ruby/2.4.0/gems/bundler-1.15.2/lib/bundler/cli.rb:360:in `exec'
/opt/zammad/vendor/bundle/ruby/2.4.0/gems/bundler-1.15.2/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/opt/zammad/vendor/bundle/ruby/2.4.0/gems/bundler-1.15.2/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
/opt/zammad/vendor/bundle/ruby/2.4.0/gems/bundler-1.15.2/lib/bundler/vendor/thor/lib/thor.rb:369:in `dispatch'
/opt/zammad/vendor/bundle/ruby/2.4.0/gems/bundler-1.15.2/lib/bundler/cli.rb:20:in `dispatch'
/opt/zammad/vendor/bundle/ruby/2.4.0/gems/bundler-1.15.2/lib/bundler/vendor/thor/lib/thor/base.rb:444:in `start'
/opt/zammad/vendor/bundle/ruby/2.4.0/gems/bundler-1.15.2/lib/bundler/cli.rb:10:in `start'
/opt/zammad/vendor/bundle/ruby/2.4.0/gems/bundler-1.15.2/exe/bundle:30:in `block in <top (required)>'
/opt/zammad/vendor/bundle/ruby/2.4.0/gems/bundler-1.15.2/lib/bundler/friendly_errors.rb:121:in `with_friendly_errors'
/opt/zammad/vendor/bundle/ruby/2.4.0/gems/bundler-1.15.2/exe/bundle:22:in `<top (required)>'
/opt/zammad/bin/bundle:3:in `load'
/opt/zammad/bin/bundle:3:in `<main>'
Tasks: TOP => searchindex:rebuild
root@zammad:~#

This is my nginx configuration on elasticsearch server. I followed suggested configuration here https://github.com/zammad/zammad/blob/develop/contrib/nginx/elasticsearch.conf with some minor adjustments:

root@elastic:~# cat /etc/nginx/sites-available/elasticsearch.conf 
#
# this is the nginx config for elasticsearch with authentication for remote login
# you need to create the auth file /etc/nginx/.htpasswd-elasticsearch with you username and password
# this can be done on the shell via: 'htpasswd -b -c /etc/nginx/.htpasswd-elasticsearch USERNAME PASSWORD'
#

upstream elasticsearch {
    server 127.0.0.1:9200;
}

server {
    listen 80;

    server_name elasticsearch;

    auth_basic "Elasticsearch";
    auth_basic_user_file /etc/nginx/.htpasswd;

    location / {
        proxy_pass http://elasticsearch;
    }
}
root@elastic:~# 

@htchief did you managed to build you elasticsearch index on different machine? Your post is closed witthout a final solution.

Interesting, it seems that elasticsearch is correctly indexing new tickets. Anyone know how can I confirm this? What I did was to try search for some ticket numbers. Elasticsearch recognizes tickets created today.

I tried to use zammad-docker-compose to figure it out how it handle the situation but things are quite different there.

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