- 下载插件(填写es版本及自己邮箱)
https://readonlyrest.com/download/
- 进入到es的安装目录下bin文件夹
cd elasticsearch/bin
- 执行命令安装wins插件
elasticsearch-plugin install file:///D:/tools/liferay/linux/readonlyrest-1.30.1_es7.6.2.zip
- 执行命令安装linux插件
./elasticsearch-plugin install file:///home/appadmin/liferay/readonlyrest-1.30.1_es7.6.2.zip
- 卸载插件
elasticsearch-plugin remove readonlyrest
- 查看已经安装的所有插件
elasticsearch-plugin list
- 在elasticsearch/config目录中新建readonlyrest.yml (与elasticsearch.yml同级目录中)
# readonlyrest.yml 内容如下 readonlyrest: enable: true response_if_req_forbidden: Sorry, your request is forbidden. access_control_rules: - name: "Accept all request for logstash and kibana grafana" type: allow auth_key: admin:123456 - name: "Require HTTP Basic Auth" type: allow auth_key: connector:connectorpwd - name: "Accept read only user" auth_key: reader:readerpwd actions: ["indices:data/read/*"]
- 禁用xpack安全设置,elasticsearch.yml文件末尾添加配置 (否则启动会报错)
# config xpack xpack.security.enabled: false
- 查看es运行状态
curl --basic -u admin:123456 http://localhost:9200/_cat/health?v