Hi Timur, When you'll create a new ODocument of class "Metrics", OrientDB will decide which cluster use based on the distributed configuration. So if you're executing this command on node1, "metrics" cluster will be taken, otherwise "metrics_node2".
Best Regards, Luca Garulli Founder & CEO OrientDB <http://orientdb.com/> On 14 August 2015 at 14:25, Timur Nasibullin <[email protected]> wrote: > Hello! > > The questions on similar issue were asked before, but I still can't find > complete answers, so I'd like to repeat it. > > I'm using OrientDB 2.1.0 GA Community Edition and trying to setup > distributed configuration. > > I have 2 nodes ("node1", "node2") which are perfectly connected into > group. When node2 is starting, I see in console handshake between nodes and > replication of my db scheme from node1 to node2. The issue is how to > configure distributing data inserts between nodes. > > I've created class "metrics" on node1, default cluster "metrics" was > created automatically. After starting of node2 new cluster "metrics_node2" > was created. I saw in console distributed configuration for this cluster: > > { > ... > "clusters": { > ... > "metrics" : { "servers": [ "node1", "node2", "<NEW_NODE>" ] } , > "metrics_node2": { "servers": [ "node2", "node1", "<NEW_NODE>" ] }, > ... > } > > which means, as far as I understand, that cluster are assigned to all > nodes, so I've changed it to > > { > ... > "clusters": { > ... > "metrics" : { "servers": [ "node1" ] } , > "metrics_node2": { "servers": [ "node2" ] }, > ... > } > > Now I supposed that all record of cluster "metrics" will be located on > node1, and all records of "metrics_node2" on node2. The next question is > how to distribute inserts between clusters. Now all inserts from client are > still saved into default cluster "metrics". Client is pretty simple, > written in java, saving looks like this: > > new ODocument("metrics").fromJson(jsonString).save(); > > I've read docs > http://orientdb.com/docs/last/Distributed-Sharding.html#limitation and it > look like I should specify cluster directly during save to get data inserts > distributed between nodes, i.e. > > new ODocument("metrics").fromJson(jsonString).save("metrics_node2"); > > It look a bit strange to me, cause I thought that data sharding should be > transparent for application, client should know nothing about DB > configuration. Are there any ways to make auto-sharding working? > > -- > > --- > You received this message because you are subscribed to the Google Groups > "OrientDB" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- --- You received this message because you are subscribed to the Google Groups "OrientDB" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
