2013-02-01 53 views
3

我创建了两个默认配置,群集状态节点:OrientDB - 如何在群集服务器上创建数据库?

"members": [{ 
    "id": "192.168.1.101:2434", 
    "listeners": [{"protocol": "ONetworkProtocolBinary", "listen": "192.168.1.101:2424"}, {"protocol": "ONetworkProtocolHttpDb", "li 
80"}], 
    "alias": "192.168.1.101:2434", 
    "status": "aligning" 
    }, { 
    "id": "192.168.1.102:2435", 
    "listeners": [{"protocol": "ONetworkProtocolBinary", "listen": "192.168.1.101:2425"}, {"protocol": "ONetworkProtocolHttpDb", "li 
80"}], 
    "alias": "192.168.1.101:2435", 
    "status": "aligning" 
    }], 
"name": "_hzInstance_1_orientdb", 
"local": "192.168.1.101:2435" 
} 

,但是当我使用Java API连接到一台服务器,并试图建立一个数据库,发生异常时,

admin = new OServerAdmin(PATH); 
      admin.connect("root", "password"); 

      if (!admin.existsDatabase()) { 
       admin.createDatabase("document", "local"); 
      } 

堆栈:

Cannot create the remote storage: demo1 
com.orientechnologies.orient.core.exception.ODatabaseException: Cannot create database 
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) 
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) 
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) 
    at java.lang.reflect.Constructor.newInstance(Unknown Source) 
    at com.orientechnologies.orient.enterprise.channel.binary.OChannelBinary.createException(OChannelBinary.java:515) 
    at com.orientechnologies.orient.enterprise.channel.binary.OChannelBinary.handleStatus(OChannelBinary.java:470) 
    at com.orientechnologies.orient.enterprise.channel.binary.OChannelBinaryAsynch.beginResponse(OChannelBinaryAsynch.java:145) 
    at com.orientechnologies.orient.enterprise.channel.binary.OChannelBinaryAsynch.beginResponse(OChannelBinaryAsynch.java:59) 
    at com.orientechnologies.orient.client.remote.OStorageRemote.beginResponse(OStorageRemote.java:1832) 
    at com.orientechnologies.orient.client.remote.OStorageRemote.getResponse(OStorageRemote.java:1863) 
    at com.orientechnologies.orient.client.remote.OServerAdmin.createDatabase(OServerAdmin.java:184) 
    at com.test.db.Client.main(Client.java:19) 
Caused by: java.lang.NullPointerException 
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) 
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) 
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) 
    at java.lang.reflect.Constructor.newInstance(Unknown Source) 
    at com.orientechnologies.orient.enterprise.channel.binary.OChannelBinary.createException(OChannelBinary.java:517) 
    ... 7 more 
com.orientechnologies.orient.core.exception.OStorageException: Cannot create the remote storage: demo1 
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) 
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) 
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) 
    at java.lang.reflect.Constructor.newInstance(Unknown Source) 
    at com.orientechnologies.common.log.OLogManager.error(OLogManager.java:119) 
    at com.orientechnologies.orient.client.remote.OServerAdmin.createDatabase(OServerAdmin.java:189) 
    at com.test.db.Client.main(Client.java:19) 
Caused by: com.orientechnologies.orient.core.exception.ODatabaseException: Cannot create database 
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) 
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) 
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) 
    at java.lang.reflect.Constructor.newInstance(Unknown Source) 
    at com.orientechnologies.orient.enterprise.channel.binary.OChannelBinary.createException(OChannelBinary.java:515) 
    at com.orientechnologies.orient.enterprise.channel.binary.OChannelBinary.handleStatus(OChannelBinary.java:470) 
    at com.orientechnologies.orient.enterprise.channel.binary.OChannelBinaryAsynch.beginResponse(OChannelBinaryAsynch.java:145) 
    at com.orientechnologies.orient.enterprise.channel.binary.OChannelBinaryAsynch.beginResponse(OChannelBinaryAsynch.java:59) 
    at com.orientechnologies.orient.client.remote.OStorageRemote.beginResponse(OStorageRemote.java:1832) 
    at com.orientechnologies.orient.client.remote.OStorageRemote.getResponse(OStorageRemote.java:1863) 
    at com.orientechnologies.orient.client.remote.OServerAdmin.createDatabase(OServerAdmin.java:184) 
    ... 1 more 
Caused by: java.lang.NullPointerException 
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) 
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) 
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) 
    at java.lang.reflect.Constructor.newInstance(Unknown Source) 
    at com.orientechnologies.orient.enterprise.channel.binary.OChannelBinary.createException(OChannelBinary.java:517) 
    ... 7 more 

为什么会发生这种情况?我如何在群集服务器上创建数据库?

THX。

回答

0

数据库的初始创建必须在群集外完成。然后将数据库复制到所有服务器并启动群集。

+0

感谢您的回答。所以我需要在本地机器上启动服务器,创建数据库,然后复制到201和204,然后重新启动201,204。这些操作是否有任何文件? – niklaus

+0

我们正在更新有关群集上的新内容的文档。但它只是目录的一个副本。 – Lvca

+0

听起来像一个黑客,'distributed-config.json'已被复制。重新启动我的双节点群集中的第二个节点后,其他数据库文件会自动获取。似乎只有最后一步没有完全自动化。 – Dag

相关问题