Skip to content

Latest commit

 

History

History
53 lines (36 loc) · 1.39 KB

es-xpack.md

File metadata and controls

53 lines (36 loc) · 1.39 KB

elasticsearch开启xpack安全认证

启动服务

docker-compose -f es-cluster.yml up -d

开启tral license

不想使用curl或者有postman 的可以导入es.postman.json文件,并且设置下url变量就可以使用

curl -H "Content-Type:application/json" -XPOST  http://127.0.0.1:9200/_xpack/license/start_trial?acknowledge=true

控制台成功日志

[2019-07-01T11:26:33,611][INFO ][o.e.l.LicenseService     ] [node-data-1] license [8c9e65ae-a727-4fa3-ab05-f690cf882a87] mode [trial] - valid

进入容器设置密码

# docker 进入容器
docker exec -it es1 /bin/bash

# 修改密码
[root@g50 elasticsearch]# bin/elasticsearch-setup-passwords interactive

elastic,apm_system,kibana,logstash_system,beats_system,remote_monitoring_user 等密码一起修改的

修改elasticsearch.yml配置

xpack.security.enabled: true可以先开启

xpack.security.enabled: true

docker重启服务

docker-compose -f es-cluster.yml restart

修改密码

postman这需要设置Authorization选择Basic Auth 并且填写用户名密码

curl -XPUT --user elastic:容器设置的密码 'http://127.0.0.1:9201/_xpack/security/user/elastic/_password'  -H "Content-Type:application/json" -d '{ "password" : "111111" }'