elasticsearch服务安装成功后,默认可以在浏览器输入地址直接访问:
现对elasticsearch增加访问权限,使用用户名和密码访问,操作步骤:
在elasticsearch安装目录的config文件下找到elasticsearch.yml配置文件,在文件末尾添加以下内容
xpack.security.enabled: truexpack.license.self_generated.type: basicxpack.security.transport.ssl.enabled: true
重新启动elasticsearch切换到elasticsearch安装目录的bin文件下,执行
./elasticsearch-setup-passwords interactive
根据提示每个用户的密码
测试:浏览器访问ip:9200,需要输入用户名和密码