我遇到了一个问题。我正在通过Docker
使用ArangoDB enterprise:3.8.6
。但不幸的是,我的查询时间比30s
长。当它失败时,错误是arangodb HTTPConnectionPool(host='127.0.0.1', port=8529): Read timed out. (read timeout=60)
。
- 我的收藏是大约4GB的巨大和~ 1.2百万-900 k文件内的集合。
我怎样才能得到完整的集合与所有文件没有任何错误?
Python代码(在我的计算机上本地运行)
from arango import ArangoClient
# Initialize the ArangoDB client.
client = ArangoClient()
# Connect to database as user.
db = client.db(<db>, username=<username>, password=<password>)
cursor = db.aql.execute(f'FOR doc IN students RETURN doc', batch_size=10000)
result = [doc for doc in cursor]
print(result[0])
[OUT]
arangodb HTTPConnectionPool(host='127.0.0.1', port=8529): Read timed out. (read timeout=60)
用于ArangoDB的docker-compose.yml
version: '3.7'
services:
database:
container_name: database__arangodb
image: arangodb/enterprise:3.8.6
environment:
- ARANGO_LICENSE_KEY=<key>
- ARANGO_ROOT_PASSWORD=root
- ARANGO_CONNECT_TIMEOUT=300
- ARANGO_READ_TIMEOUT=600
ports:
- 8529:8529
volumes:
- C:/Users/dataset:/var/lib/arangodb3
我所尝试的
cursor = db.aql.execute('FOR doc IN <Collection> RETURN doc', stream=True)
while cursor.has_more(): # Fetch until nothing is left on the server.
cursor.fetch()
while not cursor.empty(): # Pop until nothing is left on the cursor.
cursor.pop()
[OUT] CursorNextError: [HTTP 404][ERR 1600] cursor not found
# A N D
cursor = db.aql.execute('FOR doc IN <Collection> RETURN doc', stream=True, ttl=3600)
collection = [doc for doc in cursor]
[OUT] nothing # Runs, runs and runs for more than 1 1/2 hours
什么工作但仅适用于100个文档
# And that worked
cursor = db.aql.execute(f'FOR doc IN <Collection> LIMIT 100 RETURN doc', stream=True)
collection = [doc for doc in cursor]
1条答案
按热度按时间pdtvr36n1#
您可以使用custom HTTP client for Arango来增加HTTP客户端的逾时。
此处默认设置为60秒。