开启x-pack验证

  1. vi /opt/elasticsearch-7.6.2/config/elasticsearch.yml
  2. ## 底部增加开启认证
  3. xpack.security.enabled: true
  4. xpack.license.self_generated.type: basic
  5. xpack.security.transport.ssl.enabled: true
  6. ## 重启es

设置用户名和密码

## 创建keystore文件
./bin/elasticsearch-keystore create

## 交互式设置密码,指定Master节点的URL
./bin/elasticsearch-setup-passwords interactive -u 'http://212.64.29.192:9200'

image.png

Postman测试

image.png

修改认证密码

http://IP:9200/_xpack/security/user/elastic/_password

{
    "password": "es123456"
}