centOS 8.4 环境,安装了docker,docker中安装了elasticsearch 7.8.1
安装之后通过 服务器IP:9200 的方式是可以访问的,但是这样是完全暴露的,任何人都可以通过这个地址操作elasticsearch中保存的数据
环境中安装thinkphp,现在需要实现只能宿主机thinkphp能连接elasticsearch,取消 服务器IP:9200 的连接方式;
elasticsearch的配置文件elasticsearch.yml默认配置为:
network.host: 0.0.0.0
我修改为服务器公网ip,内网ip,使用elasticsearch官方手册上的_local_也都不行
开启密码验证呗
elasticsearch-setup-passwords interactive
手动配置密码elasticsearch.yml增加配置
xpack.security.enabled: true
xpack.security.authc.api_key.enabled: true
请确认你的elasticsearch安装时docker用的host还是bridge?
network.host=127.0.0.1
-p 127.0.0.1:9200:9200