Get the App
SLTechnology News&Howtos  ›  Servers  › 

ElasticSearch7.x sets user authentication

Shulou Source: shulou.com Published: 2022-06-02 23:29:16 09月22日 Update

System default user creation password

ElasticSearch is a distributed, highly scalable, high real-time search and data analysis engine based on Lucene, written in Java language. It can easily make a large number of data have the ability to search, analyze and explore.

As an open source project under the Apache license terms, Elasticsearch provides a RESTful web-based interface. Taking full advantage of the horizontal scalability of ElasticSearch can make data more valuable in a production environment. It provides scalable search

Elasticsearch is distributed, which means that the index can be divided into shards, each shard can have 0 or more copies, each node hosts one or more shards, and acts as a coordinator to delegate operations to the correct shards, rebalancing and routing are done automatically. Related data is usually stored in the same index, which consists of one or more primary shards and zero or more replication shards.

# set users to be stored in a special .security index managed by Elasticsearch #

Elasticsearch version: 7.4.2

Tool (included with es): elasticsearch-setup-passwords

1. You need to enable x-pack verification in the configuration file, modify the elasticsearch.yml file under the config directory, and add the following

# # Cross-domain issues related to head

Http.cors.enabled: true

Http.cors.allow-origin: "*"

Http.cors.allow-headers: Authorization

# # enabling Authentication

Xpack.security.enabled: true

Xpack.license.self_generated.type: basic

Xpack.security.transport.ssl.enabled: true

# # restart: systemctl restart elasticsearch.service

2. Execute the command to set the user name and password:

Users involved: elastic, kibana, logstash_system, apm_system, beats_system, remote_monitoring_user

Yum installation path file: / usr/share/elasticsearch/bin/elasticsearch-setup-passwords

# # creating keystore File

. / bin/elasticsearch-keystore create

# Interactive password setting

. / bin/elasticsearch-setup-passwords interactive

Command line test:

Curl-u elastic:th@5nMY#sXVIarnvTSX2WP-XGET "HTTP://127.0.0.1:9200/_cat"

3. The command to change the password is as follows

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

Tags: Indexes users multiple passwords data files commands search distributed analysis storage authentication special interactive value scalability content copies real-time tools Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Docker MariaDB Shulou Tech Info NVidia MySQL