2013-02-01 54 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

相關問題