根據網上的教程,當完成了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'