Hazelcast Command Line

Hazelcast Command Line is a tool which allows users to install & run Hazelcast IMDG and Management Center on local environment.

Table of Contents

Requirements

  • This tool runs under Unix-like environments only.
  • JRE 8+ should be installed.

Installation

You can install Hazelcast Command Line using Homebrew on macOS or manually on other operating systems. Support for other package managers such as yum and apt are in progress.

Install on macOS with Homebrew

To install with Homebrew, you first need to tap the hazelcast/hz repository. Once you’ve tapped the repo, you can use brew install to install:

$ brew tap hazelcast/hz
$ brew install hazelcast

Install manually with archive package

Please download the latest archive package from this repository's releases section. Once you downloaded, you can extract it and start using Hazelcast Command Line as follows:

$ wget https://github.com/hazelcast/hazelcast-command-line/releases/download/v4.2020.09/hazelcast-command-line-4.2020.09.tar.gz
$ tar -xzvf hazelcast-command-line-4.2020.09.tar.gz
$ cd hazelcast-command-line-4.2020.09/bin
$ ./hz

Basic Usages

How to start a Hazelcast member

Please run the following command to start a Hazelcast member with default configuration:

$ hz start

How to start a Hazelcast member with custom configuration

Please run the following command to start a Hazelcast member with custom configuration:

$ hz start -c /full/path/to/config-file.yaml

Please note that only XML and YAML configurations are supported and a full path is required. If -c, --config=<file> option is not set then the configuration file at [INSTALLATION_DIR]/config/hazelcast.yaml is used. You can update this file to configure starting Hazelcast members.

Additionally, you can see which file is used to configure Hazelcast instance at the first log line after start. Please see an example output below:

$ ./hz start
Aug 21, 2020 1:40:04 PM com.hazelcast.config.FileSystemYamlConfig
INFO: Configuring Hazelcast from '/Users/myuser/hazelcast-command-line/distro/build/dist/config/hazelcast.yaml'.
...

How to start a Hazelcast member with additional Java options

The following command will allow you to start a Hazelcast member with additional Java options:

$ hz start -J <option1>,<option2>

You can use , to separate multiple paths. Please note that class path settings (such as -cp, -jar) are not allowed.

When you run hz start command with any available option, it starts a Hazelcast instance in the foreground. Please use Ctrl+C (SIGINT) to gracefully stop the running instance. For all other available options, refer to hz start --help.

How to start a Hazelcast Management Center

Please run the following command to start a Hazelcast Management Center with default configuration:

$ hz mc start

How to start a Hazelcast Management Center with custom context path and port

To start a Hazelcast Management Center with custom context path and port, please run the following command:

$ hz mc start -c [new-context-path] -p [port]

For instance, if you run with hz mc start -c my-management-center -p 9000 Management Center starts at http://localhost:9000/my-management-center.

How to start a Hazelcast Management Center with additional Java options

The following command will allow you to start a Hazelcast Management Center with additional Java options:

$ hz mc start -J <option1>,<option2>

You can use , to separate multiple paths. Please note that class path settings (such as -cp, -jar) are not allowed.

When you run hz mc start command with any available option, it starts a Hazelcast Management Center instance in the foreground. Please use Ctrl+C (SIGINT) to gracefully stop the running instance. For all other available options, refer to hz mc start --help.

How to print version information

This command prints Hazelcast IMDG, Management Center and the tool's version information to the console output:

$ hz -V
CLI tool: 4.2020.09
Hazelcast IMDG: 4.1-BETA-1
Hazelcast Management Center: 4.2020.08

Installation from source

Firstly, build the distribution:

cd distro/
make

After running the make command successfully, navigate to distro/build/dist/bin folder and run the ./hz script:

cd build/dist/bin
./hz

This will print the usage options. You can follow the instructions in the output.

The compressed distribution package is also available at distro/build/package/ folder. You can extract & use it.

Checkstyle validation

Please use the following command to run checkstyle validation:

mvn -P checkstyle clean validate

SpotBugs analysis

Please use the following command to run SpotBugs analysis:

mvn -P spotbugs clean compile