简体   繁体   English

pyorient无法连接到orientdb docker

[英]pyorient can't connect to orientdb docker

I'm using pyorient 1.5.4 and the docker for orientdb 2.2.5 我正在使用pyorient 1.5.4和docker for Orientdb 2.2.5

If I use the browser to connect to the database, the server is clearly running. 如果使用浏览器连接到数据库,则服务器显然正在运行。 If I connect with pyorient, I get an error. 如果我与pyorient连接,则会出现错误。

Here is the code I use to connect to the database: 这是我用来连接数据库的代码:

import pyorient

database = pyorient.OrientDB('127.0.0.1', 2424)
database.db_open(
                'myDB',
                'root',
                'mypassword',
                db_type='graph'
            )

I get the following error: 我收到以下错误:

pyorient.exceptions.PyOrientConnectionException: Server seems to have went down

I created the docker container with the following command: 我使用以下命令创建了Docker容器:

docker run -d --name orientdb -p 2424:2424 -p 2480:2480 -v /home/myuser/Code/database:/orientdb/databases  -e ORIENTDB_ROOT_PASSWORD=mypassword orientdb:latest /orientdb/bin/server.sh  -Ddistributed=true

The server is running because connecting via the browser works fine. 服务器正在运行,因为通过浏览器进行连接可以正常工作。

It seems like the necessary ports are open so why does pyorient thinks the database is closed? 似乎必要的端口已打开,那么pyorient为什么认为数据库已关闭?

I found my problem. 我发现了问题。 I was starting the docker container with: 我正在使用以下方式启动Docker容器:

-Ddistributed=true

removing the parameter enabled me to connect just fine. 删除参数使我可以正常连接。

However, I have found that pyorient gets into an infinite loop when trying to parse the packets that's returned from orientDB under distributed mode. 但是,我发现pyorient在尝试解析分布式模式下从orientDB返回的数据包时会陷入无限循环。 This is due to a bug on pyorient. 这是由于pyorient上的错误所致。 The bug is explained in more detail over here: 该错误的详细说明如下:

https://github.com/mogui/pyorient/issues/215#issuecomment-245007336 https://github.com/mogui/pyorient/issues/215#issuecomment-245007336

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM