elasticsearch 无法建立新连接,Docker Compose Django+;干草堆+;Mysql+;弹性搜索
当我输入urlelasticsearch 无法建立新连接,Docker Compose Django+;干草堆+;Mysql+;弹性搜索,elasticsearch,docker-compose,django-haystack,elasticsearch,Docker Compose,Django Haystack,当我输入urlhttp://0.0.0.0:9200/正在工作 当我要保存或检索数据时,出现以下错误: ConnectionError(<urllib3.connection.HTTPConnection object at 0x7f234afdacc0>: Failed to establish a new connection: [Errno 111] Connection refused) caused by: NewConnectionError(<urllib3
http://0.0.0.0:9200/
正在工作
当我要保存或检索数据时,出现以下错误:
ConnectionError(<urllib3.connection.HTTPConnection object at
0x7f234afdacc0>: Failed to establish a new connection: [Errno 111]
Connection refused) caused by:
NewConnectionError(<urllib3.connection.HTTPConnection object at
0x7f234afdacc0>: Failed to establish a new connection: [Errno 111]
Connection refused)
我尝试在web和弹性搜索之间创建e网络,同样的结果。
当我呼叫http://0.0.0.0:9200/
我从服务器得到一个带有JSON的响应
settings.py中的我的Haystack配置
HAYSTACK_CONNECTIONS = {
'default': {
'ENGINE':'haystack.backends.elasticsearch_backend.ElasticsearchSearchEngine',
'URL': '0.0.0.0:9200/',
'INDEX_NAME': 'haystack'
}
}
HAYSTACK_SIGNAL_PROCESSOR = 'haystack.signals.RealtimeSignalProcessor'
我可以发布这个问题的一些内容不仅仅是代码。你应该使用
elasticsearch
而不是0.0.0
:
HAYSTACK_CONNECTIONS = {
'default': {
'ENGINE':'haystack.backends.elasticsearch_backend.ElasticsearchSearchEngine',
>>> 'URL': 'elasticsearch:9200',
'INDEX_NAME': 'haystack'
}
}
您是否尝试过使用
http://0.0.0.0:9200
(即使用http方案)用于HAYSTACK\u连接中的URL
设置?那么使用http://elasticsearch:9200
?我不记得我是否尝试过使用http,但使用elasticsearch我没有。当我到达我的电脑时,我会试试看。我今天会给你一个答复。谢谢。@Val正在使用http://elasticsearch:9200
,请发布您的答案,以便我可以给您奖金。
HAYSTACK_CONNECTIONS = {
'default': {
'ENGINE':'haystack.backends.elasticsearch_backend.ElasticsearchSearchEngine',
>>> 'URL': 'elasticsearch:9200',
'INDEX_NAME': 'haystack'
}
}