Sharding doubts

95 views
Skip to first unread message

isart....@gmail.com

unread,
Sep 15, 2015, 11:23:14 AM9/15/15
to OrientDB
I'm having some trouble to shard our database using OrientDB.

I've got an N servers cluster (for example N=3), and I want to distribute our users database evenly on the 3 servers using the user_id. As far as I understand, the data gets inserted locally on the server that receives the INSERT, but it doesn't get sharded if all the inserts are going to the same server. Is there a way to workaround this and distribute the data evenly using some kind of modulus? (%3)

Assuming that I can do that, if I end up needing to duplicate the number of servers (N=6), how can I rebalance the data? do I need to dump it and insert it again?

Sorry if that are basic questions, but I couldn't find the answer on the documentation.

Colin

unread,
Sep 15, 2015, 2:36:09 PM9/15/15
to OrientDB
Hi Isart,

Let's say you have a class called MyClass.

You can create additional clusters for that class as so:

ALTER CLASS MyClass ADDCLUSTER AwesomeCluster2
ALTER CLASS MyClass ADDCLUSTER AwesomeCluster3

Then, in the distributed config json file (in the database directory) you can specify which server (or servers) each cluster should live on.

Best regards,

-Colin

Isart Montane

unread,
Sep 16, 2015, 4:36:37 AM9/16/15
to orient-...@googlegroups.com
Hi Colin,

thanks for the email but I'm still not getting the expected results. That's what I've done so far.

- Start server1 and create database "test"
- run the following commands:
create class MyClass extends V
create property MyClass.id long
create index MyClass.id UNIQUE
insert into MyClass (id) values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10)

- start server2. The data gets replicated
- run the following command:

ALTER CLASS MyClass ADDCLUSTER myclass_orientdb02

After all that I still see the 10 rows inserted on "myclass" and nothing has been sharded on cluster "myclass_orientdb02"

 myclass                                      |    12 |                   |             10 |
 myclass_orientdb02                           |    17 |                   |              0 |

How can I rebalance the data so there's 5 rows on each cluster?


--

---
You received this message because you are subscribed to a topic in the Google Groups "OrientDB" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/orient-database/xNxmZow4Vlc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to orient-databa...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Isart Montane

unread,
Sep 16, 2015, 5:03:22 PM9/16/15
to orient-...@googlegroups.com
Hi Colin,

if that's the expected behavior what's the right way to rebalance the shards? dump all the data, divide it and insert it again on each node?

Thanks
Reply all
Reply to author
Forward
0 new messages