elasticsearch增加安全认证

1.打开elasticsearch的安全性设置,重启

http.cors.enabled: true
http.cors.allow-origin: '*'
http.cors.allow-headers: Authorization,X-Requested-With,Content-Length,Content-Type

2.导入白金版证书,重启

curl -H "Content-Type: application/json" -XPUT "http://172.16.1.160:9200/_xpack/license?acknowledge=true" -d @license.json

3.打开x-pack的安全功能,重启

xpack.security.enabled: true
xpack.security.transport.ssl.enabled: true

4.设置密码:

elasticsearch-setup-passwords interactive

修改密码:

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

5.使用密码登陆head

http://172.16.1.160:9100/?auth_user=elastic&auth_password=password

关于Zeno Chen

本人涉及的领域较多,杂而不精 程序设计语言: Perl, Java, PHP, Python; 数据库系统: MySQL,Oracle; 偶尔做做电路板的开发,主攻STM32单片机
此条目发表在NoSQL分类目录。将固定链接加入收藏夹。