Lab 4 - Hazelcast

Hazelcast

In this lab and homework, we will use the Hazelcast In-memory data grid, version 4.2.

Manual https://docs.hazelcast.com/imdg/4.2/

Javadoc https://docs.hazelcast.org/docs/4.2.4/javadoc/

Download https://hazelcast.com/open-source-projects/downloads/#hazelcast-imdg

Alternatively, you can also use the newer Hazelcast Platform version 5.1.1. There should not be major differences for the purpose of this task.

Download https://hazelcast.com/open-source-projects/downloads/ - the smaller "slim" version is sufficient.

Manual https://docs.hazelcast.com/hazelcast/5.1/

Javadoc https://docs.hazelcast.org/docs/5.1.1/javadoc/

Download source code

https://d3s.mff.cuni.cz/files/teaching/nswi080/labs/Files/sources-4.zip

You can also look at the example from the lectures: https://github.com/D-iii-S/teaching-middleware/tree/master/src/hazelcast-basic-peer/java

Explore example source

Hazelcast configuration (hazelcast.yaml):

ExampleMember.java:

ExampleClient.java:

Scripts:

Run the example

Download Hazelcast IMDG Server from https://hazelcast.org/imdg/download/. Extract hazelcast-4.2.tar.gz.

Configure the path to hazelcast in setenv.sh.

Compile source codes: bash make.sh

Run members: bash run-member.sh A bash run-member.sh B bash run-member.sh C

Run a client: bash run-client.sh

Note about security

Note that running the cluster on a publicly accessible machine is not completely safe, because other users could be able to join your cluster. In Hazelcast 4.2, security features are available only in the commercial enterprise edition.

If running hazelcast on the lab computers:

If you want to be completely safe, you could run in a virtual machine. We can provide an installed image that can be used in Qemu on the lab computers. For more information, e-mail the teaching assistant.

Lab activity task

Run the example as described below and send the output by e-mail to the teaching assistant.

Run the following scenario:

Save the output of these programs (3 members and 2 clients) and send them by e-mail.

Note: after lauching or the members, wait until the cluster re-adjusts before running the client.

Read the homework assignment

https://d3s.mff.cuni.cz/files/teaching/nswi080/labs/Files/task-4-en.html

Explore assignment source code

Client.java