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 http://192.168.1.40:9200 , you need to enter your account and password to access
visit: http://192.168.1.40:5601/
Authentication is also required to log in. The login account password is elastic/123456
Java client connection
Need to integrate with springdata es
RestHighLevelClient
@Bean
public RestHighLevelClient restHighLevelClient() {
final ClientConfiguration clientConfiguration = ClientConfiguration.builder()
.connectedTo("192.168.1.40:9200")
.withConnectTimeout(Duration.ofSeconds(5))
.withSocketTimeout(Duration.ofSeconds(3))
.withBasicAuth("elastic", "123456")
.build();
return RestClients.create(clientConfiguration).rest();
}
Springdata es configuration
spring:
elasticsearch:
rest:
uris: "http://192.168.1.40:9200"
read-timeout: "10s"
username: "elastic"
password: "123456"
connection-timeout: "10s"
Similar Posts:
- Elasticsearch configuration cluster + elk error Summary and Solution
- [Solved] Kibana 7.14.0 error: server.publicBaseUrl is missing and should be configured when running in a production environment.
- Solution of kibana starting error reporting server is not ready yet
- [Solved] Error encountered uploading license: Cannot install a [PLATINUM] license unless TLS is configured or security is disabled
- Kibana Connect Error: Kibana server is not ready yet [How to Solve]
- [Solved] Kibana Startup Error: error [03:10:02.393] [warning][process] Error: Request Timeout after 30000ms
- [Solved] Elasticsearch:exception [type=search_phase_execution_exception, reason=all shards failed]
- [Solved] Sonar6.7.2 startup error: java.lang.RuntimeException: can not run elasticsearch as root sonar.log
- Add Samba user prompt failed to add entry for user
- [Solved] Elasticsearch Error: maybe these locations are not writable or multiple nodes were started without increasing [node.max_local_storage_nodes] (was [1])?