开发者

Questions about CreateCluster tool in H2 database

开发者 https://www.devze.com 2023-03-08 12:34 出处:网络
I have a couple of questions about H2\'s create cluster tool\'s behavior. If a create a cluster specifying source A and targe开发者_StackOverflow社区t B, is H going to keep B in synch with A? In oth

I have a couple of questions about H2's create cluster tool's behavior.

  1. If a create a cluster specifying source A and targe开发者_StackOverflow社区t B, is H going to keep B in synch with A? In other words, is there a master-slave relationship maintained between both?

  2. Let's imagine that database A, B and C belong to the same cluster. What happens if two different transactions are executed on A and B simultaneoulsy. Does H2 elect a leader in the cluster to make sure there is a unique execution order for all databases in the cluster?

  3. If H2 elects a leader, what if this leader disappears? Is there an automatic failover mecanism? Is a new leader automatically elected? Can I still

  4. If I create a cluster with source A -> target B, then source B -> target C, then source C -> target D, will D get statements to execute from C, C get executions statements from B and B get statements to execute for A? Or will B, C and D get execution statements from A (or the elected leader)? In other words, do we have a chain or star organization?


See the cluster documentation on the H2 web site.

  1. There is no master / slave, no leader, and no connection between the cluster nodes. Instead, each client connects to both cluster nodes and executes the statements on both.

  2. Each client executes all statements on all cluster nodes, in the same order. Each client has a list of cluster nodes, and each cluster node keeps the list as well. The clients verify the list is the same.

  3. There is no leader. The failover mechanism is: if a client loses the connection to one of the cluster node, it removes that cluster node from it's list, and tells each cluster node to remove the cluster node from the list.

  4. This will just expand the list so you get A, B, C, D. Each client will then execute all update statements on each cluster node.

0

精彩评论

暂无评论...
验证码 换一张
取 消