Elasticsearch server not accepting connections

8.2k Views Asked by At

I'm trying to access elastic search on my ubuntu server but I'm getting a 502 error in the browser. Nothing in /var/log/elasticsearch/elasticsearch.log is looking useful. The error began after setting xpack.security.enabled: true in /etc/elasticsearch/elasticsearch.yml. After removing that line it still isn't accepting connections.

logs

[2021-08-16T18:25:17,658][INFO ][o.e.i.g.GeoIpDownloader  ] [primary-node] geoip database [GeoLite2-ASN.mmdb] is up to date, updated timestamp
[2021-08-16T18:25:17,804][INFO ][o.e.i.g.DatabaseRegistry ] [primary-node] downloading geoip database [GeoLite2-Country.mmdb] to [/tmp/elasticsearch-4936579661564518666/geoip-databases/_fum6PFWR8GpNoVibLiJrg/GeoLite2-Country.mmdb.tmp.gz]
[2021-08-16T18:25:17,807][INFO ][o.e.i.g.DatabaseRegistry ] [primary-node] downloading geoip database [GeoLite2-ASN.mmdb] to [/tmp/elasticsearch-4936579661564518666/geoip-databases/_fum6PFWR8GpNoVibLiJrg/GeoLite2-ASN.mmdb.tmp.gz]
[2021-08-16T18:25:17,812][INFO ][o.e.i.g.DatabaseRegistry ] [primary-node] downloading geoip database [GeoLite2-City.mmdb] to [/tmp/elasticsearch-4936579661564518666/geoip-databases/_fum6PFWR8GpNoVibLiJrg/GeoLite2-City.mmdb.tmp.gz]
[2021-08-16T18:25:18,156][INFO ][o.e.i.g.GeoIpDownloader  ] [primary-node] geoip database [GeoLite2-City.mmdb] is up to date, updated timestamp
[2021-08-16T18:25:18,254][INFO ][o.e.i.g.DatabaseRegistry ] [primary-node] database file changed [/tmp/elasticsearch-4936579661564518666/geoip-databases/_fum6PFWR8GpNoVibLiJrg/GeoLite2-ASN.mmdb], reload database...
[2021-08-16T18:25:18,257][INFO ][o.e.i.g.DatabaseRegistry ] [primary-node] database file changed [/tmp/elasticsearch-4936579661564518666/geoip-databases/_fum6PFWR8GpNoVibLiJrg/GeoLite2-Country.mmdb], reload database...
[2021-08-16T18:25:18,709][INFO ][o.e.c.r.a.AllocationService] [primary-node] Cluster health status changed from [RED] to [YELLOW] (reason: [shards started [[legiscan_model_bills_production_20210816163135035][0]]]).
[2021-08-16T18:25:19,030][INFO ][o.e.i.g.GeoIpDownloader  ] [primary-node] geoip database [GeoLite2-Country.mmdb] is up to date, updated timestamp
[2021-08-16T18:25:19,816][INFO ][o.e.i.g.DatabaseRegistry ] [primary-node] database file changed [/tmp/elasticsearch-4936579661564518666/geoip-databases/_fum6PFWR8GpNoVibLiJrg/GeoLite2-City.mmdb], reload database...
2

There are 2 best solutions below

1
Marcel Tanuri On

From Elasticsearc official guide

Enabling the Elasticsearch security features enables basic authentication so that you can run a local cluster with username and password authentication.

Since you've enabled xpack.security you have to create a elasticsearch password and use this pass to connect to it: https://www.elastic.co/guide/en/elasticsearch/reference/current/security-minimal-setup.html#security-create-builtin-users

Create a passowrd with steps in the link above and than try to connect again using username "elastic" and the created password

0
Binita Bharati On

Check the upper part of your start up log file. Probably, there are other errors printed. In my case too, the last line was about trying to load geoip-databases. Actual root cause was low disk space on the path where data directory was hosted.ElasticSearch version: 7.14.0