elasticsearch 6.2.4添加用户密码认证 | 您所在的位置:网站首页 › es用户认证 › elasticsearch 6.2.4添加用户密码认证 |
elasticsearch 6.3版本之前的添加认证需安装x-pack插件,6.3之后貌似去掉了这个。 1、安装x-pack 先切换到elastic用户下,在执行以下命令 $cd /data/elasticsearch-6.2.4 --进到elasticsearch的安装目录 $./bin/elasticsearch-plugin install x-pack2、设置密码: $cd /data/elasticsearch-6.2.4/bin/x-pack $./setup-passwords interactive会对elasticsearch、logstash、kibana分别设置登录密码(默认es用户名为elastic,logstash用户名为logstash_system,kibana用户名为kibana) 3、设置elasticsearch配置文件 $vim /data/elasticsearch-6.2.4/config/elasticsearch.yml --添加如下三行 http.cors.enabled: true http.cors.allow-origin: '*' http.cors.allow-headers: Authorization,X-Requested-With,Content-Length,Content-Type配置完重启下elasticsearch服务 4、测试 [elastic@data-backup elasticsearch-6.2.4]$curl http://10.163.19.231:9600 --不用密码访问,会报错 { "error":{ "root_cause":[{ "type":"security_exception","reason":"missing authentication token for REST request [/]","header": { |
CopyRight 2018-2019 实验室设备网 版权所有 |