elasticsearch入门到放弃之x-pack安全认证

基于docker构建的代码地址:https://github.com/zhaoyunxing92/docker-case/tree/develop/elasticsearch 可以直接使用,我下面也是按照这个写的这个文档

相关文章

为什么开启x-pack

肯定是为了安全啊,再者我就是因为开启了x-pack后跟spring boot整合出现了问题,后面到spring boot了我再细说,先看怎么开启和配置吧,下面是默认你看过了elasticsearch入门到放弃之搭建,如果没有就先看下

启动服务

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/elasticsearch-setup-passwords interactive

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

修改elasticsearch.yml配置

xpack.security.enabled: true可以先开启,elasticsearch入门到放弃之搭建我是先开启的

xpack.security.enabled: true

docker重启服务

docker-compose -f es-cluster.yml restart

到这里x-pack就算开启了地址了访问:http://127.0.0.1:9201发现需要密码了

修改密码

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" }'

文章导航

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容