java - Setting connection retry limit of orientdb -


hello using orientdb in distributed environment there 2 orientdb servers instances on dbsrv-1 , dbsrv-2. have followed following tutorial setup distributed databases , working fine.

but problem facing when node down , java client tries connect particular node, in such case client seems stuck in infinite loop of connection retries. have tried setting orientdb global setting via command line this:

java -dnetwork.retry=1 

also tried setting @ runtime this

oglobalconfiguration.network_socket_retry.setvalue(1); 

but nothing doesn't seem work. following code open database connection:

db = new odatabasedocumenttx("remote:localhost/mydb").open("admin", "admin"); 

java exception trace below:

oct 15, 2015 8:03:48 pm com.orientechnologies.common.log.ologmanager log severe: can not open database url localhost:2424/mydb com.orientechnologies.common.io.oioexception: cannot open connection remote server: localhost:2424/mydb         @ com.orientechnologies.orient.client.remote.ostorageremote.getavailablenetwork(ostorageremote.java:2114)         @ com.orientechnologies.orient.client.remote.ostorageremote.openremotedatabase(ostorageremote.java:1841)         @ com.orientechnologies.orient.client.remote.ostorageremote.open(ostorageremote.java:222)         @ com.orientechnologies.orient.client.remote.ostorageremotethread.open(ostorageremotethread.java:89)         @ com.orientechnologies.orient.core.db.document.odatabasedocumenttx.open(odatabasedocumenttx.java:249)         @ com.orientechnologies.orient.core.db.opartitioneddatabasepool$databasedocumenttxpolled.internalopen(opartitioneddatabasepool.java:140)         @ com.orientechnologies.orient.core.db.opartitioneddatabasepool.opendatabase(opartitioneddatabasepool.java:343)         @ com.orientechnologies.orient.core.db.opartitioneddatabasepool.acquire(opartitioneddatabasepool.java:313)         @ com.worldhubcom.cc.mydb.db.databasehelper.getdatabase(databasehelper.java:45)         @ com.worldhubcom.cc.mydb.db.subscriberdao.save(subscriberdao.java:35)         @ com.worldhubcom.cc.mydb.authen.serviceauthenticate.main(serviceauthenticate.java:24) caused by: com.orientechnologies.common.io.oioexception: error on connecting localhost:2424/mydb         @ com.orientechnologies.orient.client.remote.oremoteconnectionmanager.createnetworkconnection(oremoteconnectionmanager.java:246)         @ com.orientechnologies.orient.client.remote.oremoteconnectionmanager$1.createnewresource(oremoteconnectionmanager.java:80)         @ com.orientechnologies.orient.client.remote.oremoteconnectionmanager$1.createnewresource(oremoteconnectionmanager.java:77)         @ com.orientechnologies.common.concur.resource.oresourcepool.getresource(oresourcepool.java:94)         @ com.orientechnologies.orient.client.remote.oremoteconnectionmanager.acquire(oremoteconnectionmanager.java:101)         @ com.orientechnologies.orient.client.remote.ostorageremote.getavailablenetwork(ostorageremote.java:2103)         ... 10 more caused by: java.net.connectexception: connection refused         @ java.net.plainsocketimpl.socketconnect(native method)         @ java.net.abstractplainsocketimpl.doconnect(abstractplainsocketimpl.java:339)         @ java.net.abstractplainsocketimpl.connecttoaddress(abstractplainsocketimpl.java:200)         @ java.net.abstractplainsocketimpl.connect(abstractplainsocketimpl.java:182)         @ java.net.sockssocketimpl.connect(sockssocketimpl.java:392)         @ java.net.socket.connect(socket.java:579)         @ com.orientechnologies.orient.enterprise.channel.binary.ochannelbinaryasynchclient.<init>(ochannelbinaryasynchclient.java:83)         @ com.orientechnologies.orient.client.remote.oremoteconnectionmanager.createnetworkconnection(oremoteconnectionmanager.java:233)         ... 15 more 

try code:

public static void main(string[] args) {     orientgraphfactory factory = new orientgraphfactory("remote:localhost/test", "admin", "admin");         orientgraphnotx graph = factory.getnotx();         orientinsert.testinsertion(graph);         graph.shutdown();         system.out.println("");         system.out.println("end main");      }      public static class orientinsert {          public static void testinsertion(orientgraphnotx graph) {             system.out.println(new date());             int count  = 1000;              //create class 1             oclass clvertice1;             orientvertex vvertice1;              clvertice1 = graph.createvertextype("class1", "v");             clvertice1.createproperty("prop1", otype.string);             clvertice1.createproperty("prop2", otype.string);             clvertice1.createproperty("prop3", otype.string);               //create class 2             oclass clvertice2;             orientvertex vvertice2;              clvertice2 = graph.createvertextype("class2", "v");             clvertice2.createproperty("prop1", otype.string);             clvertice2.createproperty("prop2", otype.string);             clvertice2.createproperty("prop3", otype.string);               (int = 0; < count; ++i) {                 system.out.println("");                 system.out.println("i :"+i+" -------------------" );                 //....class 1                 vvertice1 = graph.addvertex("class:class1");                 vvertice1.setproperties("prop1", integer.tostring(i));                 vvertice1.setproperties("prop2", "22");                  vvertice1.setproperties("prop3", "3333");                   (int j = 0; j < count; ++j) {                     system.out.print("");                     system.out.print(j+" ");                     //...class 2                     vvertice2 = graph.addvertex("class:class2");                     vvertice2.setproperties("prop1", integer.tostring(i + j / 1000));                     vvertice2.setproperties("prop2", "22");                      vvertice2.setproperties("prop3", "3333");                       //edge                                       graph.addedge(null, vvertice1, vvertice2, "v1v2");                  }             }         }  } 

the result (i selected 2 vertex limit 100 e): enter image description here


Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -