ES 启用x-pack安全验证

1 启用 trial license

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

2 设置用户名密码

/usr/local/elasticsearch-6.3.0/bin/elasticsearch-setup-passwords interactive

会依次修改kibana logstash_system beats_system elastic 的密码

3 elasticsearch.yml中添加

http.cors.allow-headers: Authorization,X-Requested-With,Content-Length,Content-Type
xpack.security.enabled: true

4 kibana.yml中添加

elasticsearch.username: "elastic"
elasticsearch.password: "111111"
xpack.security.enabled: true
xpack.security.encryptionKey: "4297f44b13955235245b2497399d7a93"//这个key随便写

重启elasticsearch kibana再访问http://192.168.163.128:5601就需要输入密码了

5 es-head访问方式

http://192.168.969.888:9100/?auth_user=elastic&auth_password=you_pass

6 修改密码

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

7 php操作时也要配置账号密码才可以了

'elasticsearch' => [
        [
            'host' => '192.168.111.222',
            'port' => '9200',
            'scheme' => 'http',
            'user' => 'elastic',
            'pass' => '111111'
        ],
    ],

你可能感兴趣的:(ES 启用x-pack安全验证)