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