####官方文档: https://www.elastic.co/guide/en/shield/current/getting-started.html
###切换目录到elastic下
bin/plugin install license
bin/plugin install shield
###在国内可能安装不成功,根据报错的地址,直接下载到电脑上,再按下面的方法安装即可
bin/plugin install file:///app/elasticsearch-rtf/license-2.2.1.zip
bin/plugin install file:///app/elasticsearch-rtf/shield-2.2.1.zip
###添加用户
./bin/shield/esusers useradd username -p password -r role
###配置elasticsearch.yml ######添加ip限制
shield.transport.filter.allow: ["127.0.0.1", "::1", "localhost"]
shield.transport.filter.deny: _all
######允许匿名用户访问, 并指定权限
shield.authc:
anonymous:
username: useranme
roles: use
authz_exception: true
######记录登陆信息
shield.audit.enabled: true
在/var/log/elasticsearch 找到 *-access.log 这个文件,如果开启的话,要注意这个文件的大小
######通过elasticsearch php 通过用户名密码访问
http://user:pass@localhost:9200
######删除插件
bin/plugin remove shield