anber anber - 3 months ago 21
Python Question

pyorient can't connect to orientdb docker

I'm using pyorient 1.5.4 and the 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.

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 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?

Answer

I found my problem. I was starting the docker container with:

-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. This is due to a bug on pyorient. The bug is explained in more detail over here:

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