Book Image

Getting Started with Hazelcast, Second Edition

By : Matthew Johns
Book Image

Getting Started with Hazelcast, Second Edition

By: Matthew Johns

Overview of this book

Table of Contents (19 chapters)
Getting Started with Hazelcast Second Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Maintaining quorum


As we have seen, there are many risks and threats to the health of our cluster, with potentially many nodes being down at the same time. So what would happen if the number of nodes within our cluster dropped below a point that is required to support our application? How should we react to this? Hazelcast has introduced support for a Cluster Quorum. This allows us to define a set of health rules around individual maps or the cluster as a whole, with Hazelcast preventing access to our data (either read, write, or both) should this health rule be violated.

Let's consider the following configuration:

<hazelcast>
  <quorum name="requireAtLeastTwoNodes" enabled="true">
    <quorum-size>2</quorum-size>
    <quorum-type>WRITE</quorum-type>
  </quorum>

  <map name="default">
    <quorum-name>requireAtLeastTwoNodes</quorum-name>
  </map>
</hazelcast>

This will ensure that we can only write to the cluster maps...