在Docker上使用ElasticSearch时在Django中面临connectionError

时间:2019-06-21 10:24:17

标签: python django postgresql docker elasticsearch

我正在尝试将实例从我的Django模型加载到elasticsearch服务器,但出现错误:

elasticsearch.exceptions.ConnectionError: ConnectionError(<urllib3.connection.HTTPConnection object at 0x7f1c8cffbc18>: 
Failed to establish a new connection: [Errno -8] Servname not supported for ai_socktype) caused by: NewConnectionError(<urllib3.connection.HTTPConnection object at 0x7f1c8cffbc18>: Failed to establish a new connection: [Errno -8] Servname not supported for ai_socktype)

我已使用以下命令在本地端口9200的本地主机上使用docker建立了Elasticsearch服务器实例:

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

我可以使用curl / localhost来访问服务器,但是出现上述错误。

0 个答案:

没有答案