Get Started

Get Started

These guides demonstrate how to get started quickly with Hazelcast IMDG and Hazelcast Jet.

Hazelcast IMDG

Learn how to store and retrieve data from a distributed key-value store using Hazelcast IMDG. In this guide you’ll learn how to:

  • Create a cluster of 3 members.
  • Start Hazelcast Management Center
  • Add data to the cluster using a sample client in the language of your choice
  • Add and remove some cluster members to demonstrate data balancing capabilities of Hazelcast

Hazelcast Jet

Learn how to build a distributed data processing pipeline in Java using Hazelcast Jet. In this guide you’ll learn how to:

  • Install Hazelcast Jet and form a cluster on your computer
  • Build a simple pipeline that receives a stream of data, does some calculations and outputs some results
  • Submit the pipeline as a job to the cluster and observe the results
  • Scale the cluster up and down while the job is still running

Get Started with Hazelcast IMDG

Find out for yourself how to get a Hazelcast IMDG cluster up and running. In this Getting Started guide you’ll learn how to:

  • Create a Cluster of 3 Members
  • Start the Hazelcast Management Center
  • Add data to the cluster using a sample client in the language of your choice.
  • Add and remove some cluster members to demonstrate automatic rebalancing of data and back-ups.
Step 1

Get Hazelcast

The quickest way to get started is to use our Docker Images. Otherwise, use ZIP and TAR distributions.

Select the Hazelcast IMDG distribution of your choice.

Step 2

Create the Cluster

To create a cluster start multiple Hazelcast member processes, observe how they automatically discover each other. Hazelcast default configuration choices mean that it will seek available ports and discover via multicast.

Start Cluster member using:

Run this command three times and it will start three members that will discover each other and form a cluster.

Step 3

Start Management Center

Create an account to use Management Center and finally connect to the Hazelcast Cluster we have just started.

Start Management Center using:

Next, open a web browser to 'http://localhost:8080' and choose the 'default' security provider to provide a username and password.
Log in to Management Center and create a cluster connection, use the defaults provided. If using Docker for members, find out the Docker IP address of cluster rather than the default of localhost.

Step 4

Interact with the Cluster using a Client

The following client examples demonstrate connecting to the cluster and then updating a Map. If using Docker for members, start them with extra parameter 'hazelcast.local.publicAddress' as detailed the helloworld example here.

For more examples visit our Clients & Languages page.
package client;

import com.hazelcast.client.HazelcastClient;
import com.hazelcast.core.HazelcastInstance;
import com.hazelcast.core.IMap;

public class MapSample {
    public static void main(String[] args) {
        // Start the Hazelcast Client and connect to an already running Hazelcast Cluster on 127.0.0.1
        HazelcastInstance hz = HazelcastClient.newHazelcastClient();
        // Get the Distributed Map from Cluster.
        IMap map = hz.getMap("my-distributed-map");
        //Standard Put and Get.
        map.put("key", "value");
        map.get("key");
        //Concurrent Map methods, optimistic updating
        map.putIfAbsent("somekey", "somevalue");
        map.replace("key", "value", "newvalue");
        // Shutdown this Hazelcast client
        hz.shutdown();
    }
}
using Hazelcast.Client;

namespace Hazelcast.Examples.Org.Website.Samples
{
    public class MapSample
    {
        public static void Run(string[] args)
        {
            // Start the Hazelcast Client and connect to an already running Hazelcast Cluster on 127.0.0.1
            var hz = HazelcastClient.NewHazelcastClient();
            // Get the Distributed Map from Cluster.
            var map = hz.GetMap("my-distributed-map");
            //Standard Put and Get.
            map.Put("key", "value");
            map.Get("key");
            //Concurrent Map methods, optimistic updating
            map.PutIfAbsent("somekey", "somevalue");
            map.Replace("key", "value", "newvalue");
            // Shutdown this Hazelcast Client
            hz.Shutdown();
        }
    }
}
#include 

using namespace hazelcast::client;
int main() {
    // Start the Hazelcast Client and connect to an already running Hazelcast Cluster on 127.0.0.1
    HazelcastClient hz;
    // Get the Distributed Map from Cluster.
    IMap map = hz.getMap("my-distributed-map");
    //Standard Put and Get.
    map.put("key", "value");
    map.get("key");
    //Concurrent Map methods, optimistic updating
    map.putIfAbsent("somekey", "somevalue");
    map.replace("key", "value", "newvalue");
    // Shutdown this Hazelcast Client
    hz.shutdown();

    return 0;
}
var Client = require('hazelcast-client').Client;
// Start the Hazelcast Client and connect to an already running Hazelcast Cluster on 127.0.0.1
Client.newHazelcastClient().then(function (hz) {
    var map;
    // Get the Distributed Map from Cluster.
    hz.getMap('my-distributed-map').then(function (mp) {
        map = mp;
        // Standard Put and Get.
        return map.put('key', 'value');
    }).then(function () {
        return map.get('key');
    }).then(function (val) {
        // Concurrent Map methods, optimistic updating
        return map.putIfAbsent('somekey', 'somevalue');
    }).then(function () {
        return map.replace('key', 'value', 'newvalue');
    }).then(function (value) {
        // Shutdown this Hazelcast client
        hz.shutdown();
    });
});
import hazelcast

if __name__ == "__main__":
    # Start the Hazelcast Client and connect to an already running Hazelcast Cluster on 127.0.0.1
    hz = hazelcast.HazelcastClient()
    # Get the Distributed Map from Cluster.
    map = hz.get_map("my-distributed-map").blocking()
    # Standard Put and Get
    map.put("key", "value")
    map.get("key")
    # Concurrent Map methods, optimistic updating
    map.put_if_absent("somekey", "somevalue")
    map.replace_if_same("key", "value", "newvalue")
    # Shutdown this Hazelcast Client
    hz.shutdown()
package orgwebsite

import "github.com/hazelcast/hazelcast-go-client"

func mapSampleRun() {
	// Start the Hazelcast Client and connect to an already running Hazelcast Cluster on 127.0.0.1
	hz, _ := hazelcast.NewClient()
	// Get the Distributed Map from Cluster.
	mp, _ := hz.GetMap("myDistributedMap")
	//Standard Put and Get.
	mp.Put("key", "value")
	mp.Get("key")
	//Concurrent Map methods, optimistic updating
	mp.PutIfAbsent("somekey", "somevalue")
	mp.ReplaceIfSame("key", "value", "newvalue")
	// Shutdown this hazelcast client
	hz.Shutdown()
}    
Step 5

Scale up and down with data safety

Once you have populated some Maps with your client programs, observe the entry counts for those maps in the Management Center. You’ll notice there is a portion of primary and backup entries on each member of the cluster. If you stop a member, you’ll see how the backups are promoted on the remaining two members. Now start up the third member and the data will balance back across again. This is all automatic and any clients consuming data will still function whilst this is occurring.

Free Hazelcast Online Training Center

Whether you're interested in learning the basics of in-memory systems, or you're looking for advanced, real-world production examples and best practices, we've got you covered.

Open Gitter Chat