OrientDB to automatically create databases on startup

698 views Asked by At

I'm trying to set up a distributed OrientDB cluster (with Docker) in such a way that it automatically creates the databases from the configuration file. In my orientdb-server-config.xml file I've specified the following storages:

...
<storages>
    <!-- our testing database -->
    <storage name="testing" path="plocal:/var/orientdb/databases/testing"
        userName="admin" userPassword="admin"
        loaded-at-startup="true" />
    <!-- our development instance database -->
    <storage name="dev" path="plocal:/var/orientdb/databases/dev"
        userName="admin" userPassword="alongpassword"
        loaded-at-startup="true" />
    <!-- our production instance database -->
    <storage name="prod" path="plocal:/var/orientdb/databases/prod"
        userName="admin" userPassword="alongpassword"
        loaded-at-startup="true" />
</storages>
...
<properties>
    ...
    <entry name="server.database.path" value="/var/orientdb/databases" />
    ...
</properties>

OrientDB, upon startup (dserver.sh), gives the following exception:

Caused by: com.orientechnologies.orient.core.exception.OStorageException: Cannot open the storage 'testing' because it does not exist in path: /var/orientdb/databases/testing
    at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.open(OAbstractPaginatedStorage.java:164)
    ... 11 more

I really don't want to have to create these databases manually - does OrientDB support a way of doing this automatically for me? I only want it to create the database if it doesn't exist yet, so having a script that does it automatically from the command line isn't really an option.

My only alternatives right now are to create a database manually, via the console, or programmatically, via my application - both of which I'm trying to avoid here for a variety of reasons.

From the OrientDB code, it seems as though it should be creating these databases for me. Is this perhaps a bug, or am I missing something here?

1

There are 1 answers

0
Thane Thomson On BEST ANSWER

Contributed a patch to OrientDB to fix this: https://github.com/orientechnologies/orientdb/pull/4400