Elasticsearch Docker容器在启动时挂起而没有错误

时间:2019-06-23 13:57:51

标签: elasticsearch docker-toolbox

我正在Windows 10 Home上的Docker中设置Elasticsearch实例(因此我使用Docker Toolbox是因为我没有Hyper-V)。此时,我正在寻找的是一个curl可以运行的Elasticsearch实例。

我一直遵循Elasticsearch网站上提供的setup,从理论上讲,我已经完成了似乎只需要创建一个开发容器的唯一步骤,即“运行此命令以启动开发实例”

日志中的最后几行输出如下:

{"type": "server", "timestamp": "2019-06-23T13:30:22,989+0000", "level": "INFO", "component": "o.e.x.i.a.TransportPutLifecycleAction", "cluster.name": "docker-cluster", "node.name": "351001acfb2c", "cluster.uuid": "5KONF0ypTuWqfDJav1ludw", "node.id": "139z-22WSS6BpsLt49dnYg",  "message": "adding index lifecycle policy [watch-history-ilm-policy]"  }
{"type": "server", "timestamp": "2019-06-23T13:30:24,512+0000", "level": "INFO", "component": "o.e.l.LicenseService", "cluster.name": "docker-cluster", "node.name": "351001acfb2c", "cluster.uuid": "5KONF0ypTuWqfDJav1ludw", "node.id": "139z-22WSS6BpsLt49dnYg",  "message": "license [ec9b4a7e-7c13-4249-9378-b1dd17de1746] mode [basic] - valid"  }

它断断续续地写了一行,但是没有其他内容了:

{"type": "server", "timestamp": "2019-06-23T13:52:58,676+0000", "level": "INFO", "component": "o.e.m.j.JvmGcMonitorService", "cluster.name": "docker-cluster", "node.name": "5bd339b9053c", "cluster.uuid": "9KC7mhtMSk-AhmmbSJ7pdA", "node.id": "K-A62Z4GTFylOFqL_B-bsg",  "message": "[gc][7] overhead, spent [269ms] collecting in the last [1s]"  }

我正在运行的命令是:

docker run -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" docker.elastic.co/elasticsearch/elasticsearch:7.1.1

我用来尝试获得该服务的curl是:

curl http://localhost:9200/_status

curl http://127.0.0.1:9200/_status

这可能是我要解决的所有错误,并且这完全是预期的行为,但这无法curl实现,并且这似乎是您检查其是否有效或无效的手段。不。任何建议,不胜感激!

1 个答案:

答案 0 :(得分:0)

事实证明,这是预期的行为,是由于Docker Toolbox是Hyper-V不可用时的一种变通方法。

this Q&A中所述,与Docker Toolbox一起使用的实际IP地址实际上是 192.168.99.100 ,而不是127.0.0.1或0.0.0.0。

因此,要访问与Elasticsearch有关的任何内容(假设您的Docker容器已达到上述有关许可证的要点),您的根地址应为:

http://192.168.99.100:9200

http://192.168.99.100:9300