|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.zookeeper.server.quorum.flexible.QuorumHierarchical
public class QuorumHierarchical
This class implements a validator for hierarchical quorums. With this construction, zookeeper servers are split into disjoint groups, and each server has a weight. We obtain a quorum if we get more than half of the total weight of a group for a majority of groups. The configuration of quorums uses two parameters: group and weight. Groups are sets of ZooKeeper servers, and we set a group by passing a colon-separated list of server ids. It is also necessary to assign weights to server. Here is an example of a configuration that creates three groups and assigns a weight of 1 to each server: group.1=1:2:3 group.2=4:5:6 group.3=7:8:9 weight.1=1 weight.2=1 weight.3=1 weight.4=1 weight.5=1 weight.6=1 weight.7=1 weight.8=1 weight.9=1 Note that it is still necessary to define peers using the server keyword.
| Constructor Summary | |
|---|---|
QuorumHierarchical(int numGroups,
HashMap<Long,Long> serverWeight,
HashMap<Long,Long> serverGroup)
This contructor takes the two hash maps needed to enable validating quorums. |
|
QuorumHierarchical(Properties qp)
This constructor takes a set of properties. |
|
QuorumHierarchical(String filename)
This contructor requires the quorum configuration to be declared in a separate file, and it takes the file as an input parameter. |
|
| Method Summary | |
|---|---|
boolean |
containsQuorum(HashSet<Long> set)
Verifies if a given set is a quorum. |
long |
getWeight(long id)
Returns the weight of a server. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public QuorumHierarchical(String filename)
throws QuorumPeerConfig.ConfigException
QuorumPeerConfig.ConfigException
public QuorumHierarchical(Properties qp)
throws QuorumPeerConfig.ConfigException
QuorumPeerConfig.ConfigException
public QuorumHierarchical(int numGroups,
HashMap<Long,Long> serverWeight,
HashMap<Long,Long> serverGroup)
numGroups - serverWeight - serverGroup - | Method Detail |
|---|
public long getWeight(long id)
getWeight in interface QuorumVerifierid - public boolean containsQuorum(HashSet<Long> set)
containsQuorum in interface QuorumVerifier
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||