I’m currently maintaining an OrientJS server that connects to a single-node OrientDB virtual machine and performs all necessary CRUD options.
To call the DB we added a connector class that creates an OrientDB.Db object as a singleton, which is connected to the DB at server startup. An instance of this Db object is then called everytime an operation is performed. On a single-host setup, this approach always worked flawlessly for us.
We recently updated the cluster to the 3.1.12 version and we’re trying to set up a multi-node environment. Connection to the secondary nodes seems to work fine by just adding additional with the respective ServerConfigs in the orientjs.ServerConfig interface (simply as an array in the “servers” field), but when a primary node is stopped and recreated, we sometimes randomly encounter the following error on writing only (reading works fine)
Error during saving of record with rid #[XX:XXXX]\r\n\tDB name=[x]
When this happens, writing is simply not possibile anymore on the db, and the only way to recreate a working environment is to restart the server. We didn’t identify and replicate the cause of the errors, as sometimes stopping the primary node and recreating doesn’t seem to cause issues on the server.
I think server configuration is to blame here, as we don’t encounter problems on DB side when operating outside of the OrientJS server.
Can someone point me to some best practices or documentation for a multi-node environment? I checked the documentation but from there it seems like a db call is to be handled by creating a connection and a session every single time, where our approach allows us instead to connect just once and perform all operations on a readly-available DB instance. But I’m afraid this could be the cause of the issue with the reconnection altogether… (maybe the server doesn’t know it has to switch host to one of the alternative ones?)
Thanks in advance!