Docker安装Elasticsearch 7.x设置默认账户密码出错

根据网上的教程,当完成了Elasticsearch 7.x安装后,会要求你用Docker命令登陆到master节点的容器执行以下命令来设置默认账户的密码。

bin/elasticsearch-setup-passwords interactive

以我的试验会得到以下报错,大致意思是抱怨连接不上这个URL。

Connection failure to: http://172.19.0.8:9200/_security/_authenticate?pretty failed: Connection refused

ERROR: Failed to connect to elasticsearch at http://172.19.0.8:9200/_security/_authenticate?pretty. Is the URL correct and elasticsearch running?

经查找172.19.0.8并非容器的IP,由此可见此命令并不能获得正确的URL,因此要指定Master节点的URL.

如下为完整的命令,其中es750-masterdata-1是其中一个Master节点的名字。

bin/elasticsearch-setup-passwords interactive -u 'http://es750-masterdata-1:9200'
原文地址:https://www.cnblogs.com/keitsi/p/12293794.html