Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Getting Started with Hazelcast

You're reading from  Getting Started with Hazelcast

Product type Book
Published in Aug 2013
Publisher
ISBN-13 9781782167303
Pages 136 pages
Edition 1st Edition
Languages
Author (1):
Matthew Johns Matthew Johns
Profile icon Matthew Johns

Table of Contents (18) Chapters

Getting Started with Hazelcast
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
What is Hazelcast? Getting off the Ground Going Concurrent Divide and Conquer Listening Out Spreading the Load Typical Deployments From the Outside Looking In Going Global Playing Well with Others Configuration Summary Index

XML configuration


The following is a complete example of the hazelcast.xml configuration file with an overview of each section within it:

<hazelcast>

Cluster name

  <group>
    <name>dev</name>
    <password>dev-pass</password>
  </group>
Management Center
  <management-center enabled="true" update-interval="5">
    http://manager-center-host:8080/mancenter
  </management-center>

General Properties
  <properties>
    <property name="hazelcast.map.partition.count">271</property>
  </properties>

WAN replication configuration

  <wan-replication name="our-global-cluster">
    <target-cluster group-name="paris" group-password="paris-pass">

      <replication-impl>
        com.hazelcast.impl.wan.WanNoDelayReplication
      </replication-impl>
      <end-points>
        <address>12.34.56.78:5701</address>
      </end-points>

    </target-cluster>
  </wan-replication>

Local network/interface binding

  <network>
    <port auto-increment="false">5701</port>

    <interfaces enabled="true">
      <interface>192.168.0.*</interface>
    </interfaces>

Cluster discovery

Multicast, Unicast, or EC2-based

    <join>
      <multicast enabled="true">
        <multicast-group>224.2.2.3</multicast-group>
        <multicast-port>54327</multicast-port>
      </multicast>
      <tcp-ip enabled="true">
        <interface>127.0.0.1</interface>
      </tcp-ip>
      <aws enabled="true">
        <access-key>ourApiAccessKey</access-key>
        <secret-key>ourApiSecretKey</secret-key>
        <region>eu-west-1</region>
      </aws>
    </join>
  </network>

Per map or default map configuration

  <map name="capitals">

cluster_wide_map_size
partitions_wide_map_size
max_size_per_jvm
used_heap_size
used_heap_percentage
    <max-size policy="cluster_wide_map_size">10</max-size>

LRU: Least Recently Used

LFU: Least Frequently Used

NONE

    <eviction-policy>LFU</eviction-policy>
    <eviction-percentage>20</eviction-percentage>

Backup = Synchronous copies
Async = Asynchronous copies
Total copies = 1 Main + Backup + Async
    <backup-count>1</backup-count>
    <async-backup-count>1</async-backup-count>

Age expiry and idle expiry times

    <time-to-live-seconds>86400</time-to-live-seconds>
    <max-idle-seconds>3600</max-idle-seconds>

hz.NO_MERGE
hz.ADD_NEW_ENTRY
hz.HIGHER_HITS
hz.LATEST_UPDATE
    <merge-policy>hz.LATEST_UPDATE</merge-policy>

Selected WAN replication configuration

    <wan-replication-ref name="our-global-cluster">
      <merge-policy> hz.LATEST_UPDATE </merge-policy>
    </wan-replication-ref>

Indexes on values

    <indexes>
      <index ordered="false">name</index>
      <index ordered="true">population</index>
    </indexes>

Listeners notified on map events

    <entry-listeners>
      <entry-listener include-value="true" local="false">
        com.packtpub.hazelcast.listeners.MapEntryListener
      </entry-listener>
    </entry-listeners>

  </map>

Listener notified on topic broadcast

  <topic name="default">
    <message-listeners>
      <message-listener>
        com.hazelcast.examples.MessageListener
      </message-listener>
    </message-listeners>
  </topic>

Cluster-wide listener registration

  <listeners>
    <listener>
      com.packtpub.hazelcast.listeners.TopicListener
    </listener>
  </listeners>

</hazelcast>
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}