Elasticsearch + kibana set user name and password to log in

Elasticsearch version: 7.7.1

to configure

Modify the configuration file of es: elasticsearch.yml, and add the following configuration

xpack.security.enabled: true
xpack.license.self_generated.type: basic
xpack.security.transport.ssl.enabled: true

Execute the command to set the user name and password in the bin directory of ES

./elasticsearch-setup-passwords interactive

Passwords for six accounts will be set here: elastic, APM_ system,kibana,logstash_ system,beats_ system,remote_ monitoring_ user.

Modify kibana configuration kibana. YML :

Es the command to change the password is as follows:

curl -H "Content-Type:application/json" -XPOST -u elastic 'http://192.168.140:9200/_xpack/security/user/elastic/_password' -d '{ "password" : "123456" }'

Restart es and kibana

visit , you need to enter your account and password to access


Authentication is also required to log in. The login account password is elastic/123456

Java client connection

Need to integrate with springdata es


    public RestHighLevelClient restHighLevelClient() {

        final ClientConfiguration clientConfiguration = ClientConfiguration.builder()
                .withBasicAuth("elastic", "123456")
        return RestClients.create(clientConfiguration).rest();

Springdata es configuration

      uris: ""
      read-timeout: "10s"
      username: "elastic"
      password: "123456"
      connection-timeout: "10s"

Similar Posts: