Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could not connect to elasticsearch:7.17.4 deploy with docker #20472

Closed
Tsuk1ko opened this issue Nov 12, 2022 · 5 comments
Closed

Could not connect to elasticsearch:7.17.4 deploy with docker #20472

Tsuk1ko opened this issue Nov 12, 2022 · 5 comments
Labels
bug Something isn't working deployment Related to runtime configuration, production setups troubleshooting Asking for deployment help

Comments

@Tsuk1ko
Copy link

Tsuk1ko commented Nov 12, 2022

Steps to reproduce the problem

  1. Uncomment all parts about elasticsearch in docker-compose.yml
  2. Setup and start docker (directory permissions have been set correctly)
  3. A tip about "Could not connect to Elasticsearch" will show in /admin/dashboard, but elasticsearch container started successfully
  4. Clear elasticsearch data folder and change elasticsearch:7.17.4 back to elasticsearch-oss:7.10.2 in docker-compose.yml (revert cc7cebb and e3cebfa)
  5. Restart docker, the tip disappear

Expected behaviour

Could connect to Elasticsearch

Actual behaviour

Could not connect to Elasticsearch

Detailed description

No response

Specifications

Mastodon v4.0.0rc2
Docker 20.10.21
Docker Compose v2.4.1

@Tsuk1ko Tsuk1ko added the bug Something isn't working label Nov 12, 2022
@ineffyble ineffyble added troubleshooting Asking for deployment help deployment Related to runtime configuration, production setups labels Nov 12, 2022
@pedroCX486
Copy link

It works for me, did uncomment the depends_on line and check if elastic isn’t throwing the permission exception?

For future reference, if anyone is having that AccessDeniedException problem:

sudo chown -R 1000:1000 elasticsearch/

This solves it. Make sure also the docker-compose.yml has the variables needed for ES to boot up.

@riker77
Copy link

riker77 commented Nov 19, 2022

The problem still persisted for me, although I already did the things pedroCX486 mentioned. Looking at the logs of the elasticsearch container, I found this line in there:

max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

So I set the vm.max_map_count accordingly on my Linux host.

sysctl -w vm.max_map_count=262144

In order for this setting to survive a reboot, I added the assignment to /etc/sysctl.conf.

After that, the start of the es container succeeds.

@Tsuk1ko
Copy link
Author

Tsuk1ko commented Nov 19, 2022

@riker77 Thank you, it works for me!

@Tsuk1ko Tsuk1ko closed this as completed Nov 19, 2022
@bold84
Copy link

bold84 commented Nov 27, 2022

For anyone else running into the issue... it's also wort checking, if the elastic search host in the .env.production file is set to the correct hostname. I have found it set to localhost, which didn't work with the docker-compose setup.
Setting it to

es

helped.

@k5123
Copy link

k5123 commented Dec 22, 2022

Here's another pointer that solved ES problems for me: After following all prior suggestions, the last problem was inside the env file: the default sets a username and password.

The default install with docker-compose builds an ES instance that doesn't use authentication with username/pass, therefore specifying ES_USER/ES_PASS AT ALL will lead to problems.

Comment out both username/password for ES and it should work. It did for me at least.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working deployment Related to runtime configuration, production setups troubleshooting Asking for deployment help
Projects
None yet
Development

No branches or pull requests

6 participants