when i try its requesting host password and what is the host password. i tried with changeme and getting same error
curl -H 'Content-Type: application/json' -XPUT -u elastic 'http://10.3.195.14:9200/_xpack/security/user/elastic/_password' -d '{ "password" : "elastic" }'
Enter host password for user 'elastic':
You need to run the setup-passwords tool to set the password for the internal users (elastic being one of them ).
This is how this thread started, where you had an error running the setup-passwords tool. Now that you fixed the network.host setting and you restarted Elasticsearch, did you run setup-passwords ? If so what happens ?
Please take the time to describe exactly what the behavior is and always include the error message from Elasticsearch, even if it looks similar or the same.
As you have shown above, your correct IP address is 10.3.145.14 and not10.3.195.14 . Please set the correct value for your IP address in your network.host setting, restart Elasticsearch and try again.
[root@lpdosput020008 config]# docker exec -it elasticsearch bash
[elasticsearch@e9f56d662f9d ~]$ cd bin/x-pack/
[elasticsearch@e9f56d662f9d x-pack]$ ./setup-passwords auto
Initiating the setup of passwords for reserved users elastic,kibana,logstash_system.
The passwords will be randomly generated and printed to the console.
Please confirm that you would like to continue [y/N]y
Connection failure to: http://10.3.195.14:9200/_xpack/security/user/kibana/_password?pretty failed: Read timed out
ERROR: Failed to set password for user [kibana].
It would be beneficial to mention up front that you're running Elasticsearch in docker, as we would be able to give more targeted answers
10.3.195.14 is the IP address of your host and not the IP address for the Docker container. The container knows nothing about the hosts IP address so it doesn't know how to reach 10.3.195.14.
From your host, the curl command works because port 9200 is mapped to the container as part of the docker run command you ran to start the container.
You need to either set network.host to the internal IP of your container ( use docker inspect elasticsearch ), or don't set it at all so elasticsearch binds to localhost (of the container). Either way, you will still be able to access elasticsearch at 10.3.195.14 and your commands from within the container will work
From your examples, the problem here is that you were running curl from the host, but setup-passwords from inside the container.
That's not testing the same thing. I assume that curl will fail in a similar way if you run it inside the container.
You need to use the --url option to setup-passwords.
As best I can tell, your elasticsearch.yml has a configuration where you are publishing on an IP that doesn't resolve to the local machine. That is, from inside the container, 10.3.195.14 is not a locally resolved IP, so setup-passwords cannot communicate with the node as you've configured it.
Just pass --url="http://localhost:9200/" to your setup-passwords command.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.