pyspider +elasticsearch ,启动时报错
如题,我用最新的pyspider版本,连接远程的elasticsearch ,会说host无法识别
File "D:\Anaconda2\lib\site-packages\pyspider\run.py", line 43, in <lambda>
return utils.Get(lambda: connect_database(value))
File "D:\Anaconda2\lib\site-packages\pyspider\database\__init__.py", line 44, in connect_database
db = _connect_database(url)
File "D:\Anaconda2\lib\site-packages\pyspider\database\__init__.py", line 170, in _connect_database
return TaskDB([parsed.netloc], index=index)
File "D:\Anaconda2\lib\site-packages\pyspider\database\elasticsearch\taskdb.py", line 23, in __init__
self.es = Elasticsearch(hosts=hosts)
File "D:\Anaconda2\lib\site-packages\elasticsearch\client\__init__.py", line 168, in __init__
self.transport = transport_class(_normalize_hosts(hosts), **kwargs)
File "D:\Anaconda2\lib\site-packages\elasticsearch\transport.py", line 112, in __init__
self.set_connections(hosts)
File "D:\Anaconda2\lib\site-packages\elasticsearch\transport.py", line 165, in set_connections
connections = map(_create_connection, hosts)
File "D:\Anaconda2\lib\site-packages\elasticsearch\transport.py", line 164, in _create_connection
return self.connection_class(**kwargs)
File "D:\Anaconda2\lib\site-packages\elasticsearch\connection\http_urllib3.py", line 72, in __init__
self.pool = pool_class(host, port=port, timeout=self.timeout, maxsize=maxsize, **kw)
File "D:\Anaconda2\lib\site-packages\urllib3\connectionpool.py", line 173, in __init__
ConnectionPool.__init__(self, host, port)
File "D:\Anaconda2\lib\site-packages\urllib3\connectionpool.py", line 70, in __init__
raise LocationValueError("No host specified.")
urllib3.exceptions.LocationValueError: No host specified.
基本的配置参数如下,其中host是远程的ip
{"taskdb": "elasticsearch+taskdb:http://host:9200/taskdb",
"projectdb": "elasticsearch+projectdb:http://host:9200/projectdb",
"resultdb": "elasticsearch+resultdb:http://host:9200/resultdb"
}
急求大神帮忙
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
已解决问题,是config 里面的配置写的有点问题
通过 Elasticsearch(['ip:port'],http_auth=(username,pwd),timeout=30) 解决,是因为密码用到了@#,希望帮到需要的人
请问你的elasticsearch用的是哪个版本?
我用5.3.3在写入时报400错误。错误入下:
/usr/local/lib/python3.5/site-packages/elasticsearch/client/utils.py", line 73, in _wrapped