简体   繁体   中英

The best way to create connection to OrientDB

I create a connection to the database is as follows:

ODatabaseDocumentTx db = new ODatabaseDocumentTx("remote:host1/test")
    .open("admin", "admin");

I have 2 nodes of DB. When I shutdown node, which was in constructor, then throws exception:

Database 'plocal:/root/orientdb/databases/test' is closed

Of course, I can catch this exception and create new connection to another server, but I think, this is wrong.

Is there way to create connection to full DB, not to single node of cluster?

If you run 2 servers in cluster the switch is supposed to be automatic and transparent. But start 2 nodes using dserver.sh/bat instead of server.sh/bat and assure two nodes see each other. Look at this tutorial: https://github.com/orientechnologies/orientdb/wiki/Tutorial%3A-setup-a-distributed-database

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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