Distributed Architecture Lifecycle

In OrientDB Distributed Architecture all the nodes are masters (Multi-Master), while in most DBMS the replication works in Master-Slave mode where there is only one Master node and N Slaves that are use only for reads or when the Master is down. Starting from OrientDB v2.1, you can also assign the role of REPLICA to some nodes.

When start a OrientDB server in distributed mode (bin/dserver.sh) it looks for an existent cluster. If exists the starting node joins the cluster, otherwise creates a new one. You can have multiple clusters in your network, each cluster with a different “group name”.

Joining a cluster

Auto discovering

At startup each Server Node sends an IP Multicast message in broadcast to discover if an existent cluster is available to join it. If available the Server Node will connect to it, otherwise creates a new cluster.

image

This is the default configuration contained in config/hazelcast.xml file. Below the multicast configuration fragment:

  1. <hazelcast>
  2. <network>
  3. <port auto-increment="true">2434</port>
  4. <join>
  5. <multicast enabled="true">
  6. <multicast-group>235.1.1.1</multicast-group>
  7. <multicast-port>2434</multicast-port>
  8. </multicast>
  9. </join>
  10. </network>
  11. </hazelcast>

If multicast is not available (typical on Cloud environments), you can use:

For more information look at Hazelcast documentation about configuring network.

Security

To join a cluster the Server Node has to configure the cluster group name and password in hazelcast.xml file. By default these information aren’t encrypted. If you wan to encrypt all the distributed messages, configure it in hazelcast.xml file:

  1. <hazelcast>
  2. ...
  3. <network>
  4. ...
  5. <!--
  6. Make sure to set enabled=true
  7. Make sure this configuration is exactly the same on
  8. all members
  9. -->
  10. <symmetric-encryption enabled="true">
  11. <!--
  12. encryption algorithm such as
  13. DES/ECB/PKCS5Padding,
  14. PBEWithMD5AndDES,
  15. Blowfish,
  16. DESede
  17. -->
  18. <algorithm>PBEWithMD5AndDES</algorithm>
  19. <!-- salt value to use when generating the secret key -->
  20. <salt>thesalt</salt>
  21. <!-- pass phrase to use when generating the secret key -->
  22. <password>thepass</password>
  23. <!-- iteration count to use when generating the secret key -->
  24. <iteration-count>19</iteration-count>
  25. </symmetric-encryption>
  26. </network>
  27. ...
  28. </hazelcast>

All the nodes in the distributed cluster must have the same settings.

image

For more information look at: Hazelcast Encryption.

Join to an existent cluster

You can have multiple OrientDB clusters in the same network, what identifies a cluster is it’s name that must be unique in the network. By default OrientDB uses “orientdb”, but for security reasons change it to a different name and password. All the nodes in the distributed cluster must have the same settings.

  1. <hazelcast>
  2. <group>
  3. <name>orientdb</name>
  4. <password>orientdb</password>
  5. </group>
  6. </hazelcast>

In this case Server #2 joins the existent cluster.

image

When a node joins an existent cluster, the most updated copy of the database is downloaded to the joining node. If any copy of database was already present, that is moved under backup/databases folder.

Multiple clusters

Multiple clusters can coexist in the same network. Clusters can’t see each others because are isolated black boxes.

image

Distribute the configuration to the clients

Every time a new Server Node joins or leaves the Cluster, the new Cluster configuration is broadcasted to all the connected clients. Everybody knows the cluster layout and who has a database!

image

Fail over management

When a node is unreachable

When a Server Node becomes unreachable (because it’s crashed, network problems, high load, etc.) the Cluster treats this event as if the Server Node left the cluster.

image

Automatic switch of servers

All the clients connected to the unreachable node will switch to another server transparently without raising errors to the Application User Application doesn’t know what is happening!

image

Re-distribute the updated configuration again

After the Server #2 left the Cluster the updated configuration is sent again to all the connected clients.

image

Continue with: