How to set up security for elasticsearch cluster

network.host: ip1

discovery.seed_hosts: ["ip1", "ip2"]

cluster.initial_master_nodes: ["ip1"]


network.host: ip2

discovery.seed_hosts: ["ip1", "ip2"]

cluster.initial_master_nodes: ["ip1"]

these are two yml files on two servers

how do i set up security for this cluster?

after enabling x-pack security
and running this
./bin/elasticsearch-setup-passwords auto

i am getting this error

Connection failure to: http://ip1:9200/_security/_authenticate?pretty failed: Connection refused

ERROR: Failed to connect to elasticsearch at http://ip1:9200/_security/_authenticate?pretty. Is the URL correct and elasticsearch running?

Have you been through Configure security for the Elastic Stack | Elasticsearch Guide [7.14] | Elastic?

yes, this error is coming when i try to generate passwords using

./bin/elasticsearch-setup-password auto

Connection failure to: http://ip1:9200/_security/_authenticate?pretty failed: Connection refused

ERROR: Failed to connect to elasticsearch at http://ip1:9200/_security/_authenticate?pretty. Is the URL correct and elasticsearch running?

Ok, so what does Elasticsearch say when it starts up, because it needs to be running for that command to work.

Yes it is running

with network host ip1

Can you curl ip1:9200 and get a response?

connection refuse is coming up

but if i remove x-pack security the its working

You'll need to show us your Elasticsearch logs then.

It looks like you have more than one node which requires TLS to be set up. Have you done this?

In doc, It is stated in that

After adding password protection in the minimal security configuration, you’ll need to configure Transport Layer Security (TLS).

but failing to add password protection

Should i do tls before minimul security configuration ?

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