Hazelcast Command Line is a tool which allows users to install & run Hazelcast and Management Center on local environment.
- Requirements
- Installation
- Basic Usages
- How to start a Hazelcast member
- How to start a Hazelcast member with custom configuration
- How to start a Hazelcast member with additional Java options
- How to start a Hazelcast member with additional classpath
- How to start a Hazelcast Management Center
- How to start a Hazelcast Management Center with custom context path and port
- How to start a Hazelcast Management Center with additional Java options
- How to print version information
- Installation from source
- This tool runs under Unix-like environments only.
- JRE 8+ should be installed.
You can install Hazelcast Command Line using Homebrew, yum, apt, or manually using the archive package.
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
The RPM packages for Hazelcast Command Line is kept at Hazelcast's RPM repository. Please run the following commands to install it using yum/dnf:
$ wget https://repository.hazelcast.com/rpm/hazelcast-rpm.repo -O hazelcast-rpm.repo
$ sudo mv hazelcast-rpm.repo /etc/yum.repos.d/
$ sudo yum install hazelcast
You can find the The Debian packages for Hazelcast Command Line at Hazelcast's Debian repository. Run the following commands to install it using apt:
$ wget -qO - https://repository.hazelcast.com/api/gpg/key/public | sudo apt-key add -
$ echo "deb https://repository.hazelcast.com/debian stable main" | sudo tee -a /etc/apt/sources.list
$ sudo apt update && sudo apt install hazelcast
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.12/hazelcast-4.1.1.tar.gz
$ tar -xzvf hazelcast-4.1.1.tar.gz
$ cd hazelcast-4.1.1/bin
$ ./hz
Please run the following command to start a Hazelcast member with default configuration:
$ hz start
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'.
...
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 options. Please note that class path settings (such as -cp
, -jar
) are not allowed (See this section to add classes or JAR files to the classpath).
You can run the following command to start a Hazelcast member with additional classes or JAR files in the classpath:
$ hz start -j <path1>,<path2>
Please use ,
to separate multiple paths to classes or JAR files.
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
.
Please run the following command to start a Hazelcast Management Center with default configuration:
$ hz mc start
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
.
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 options. 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
.
This command prints Hazelcast, Management Center and the tool's version information to the console output:
$ hz -V
CLI tool: 4.2020.12
Hazelcast: 4.1.1
Hazelcast Management Center: 4.2020.12
Firstly, build the distribution:
cd distro/
make
After running the make
command successfully, navigate to distro/build/dist/hazelcast-{hazelcast.version}/bin
folder and run the ./hz
script:
cd build/dist/hazelcast-{hazelcast.version}/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/dist/
folder. You can extract & use it.
Please use the following command to run checkstyle validation:
mvn -P checkstyle clean validate
Please use the following command to run SpotBugs analysis:
mvn -P spotbugs clean compile