Hazelcast Access Using CLI

Suppose I have a Hazelcast instance running somewhere on a remote machine, and it runs in the official Docker image. Therefore, I wanted to see some of the data that Hazelcast stores, as in the first video here . So I'm wondering if there is a way to connect to an existing Hazelcast instance from any CLI utility to receive data, but without a control center ?

+4
source share
3 answers

Andriy,

You can use the Hazelcast demo application. You can find it here:

  • com.hazelcast.console.ConsoleAppmember console, part hazelcast*.jar. See GH
  • com.hazelcast.client.console.ClientConsoleApp , hazelcast-client*.jar. . GH

server.sh / CLI

java -server $JAVA_OPTS com.hazelcast.console.ConsoleApp

java -server $JAVA_OPTS com.hazelcast.client.console.ClientConsoleApp

, .

+4

CLI com.hazelcast.client.console.ClientConsoleApp, hazelcast*.jar. , :

  • clientConsole.sh ( <hazelcast installation>/demo) script ( , ), : java -Djava.net.preferIPv4Stack=true -cp .:../lib/hazelcast-all-<version>.jar com.hazelcast.client.console.ClientConsoleApp
  • script (, <hazelcast installation>/demo)
  • hazelcast-client.xml :
<hazelcast-client xmlns="http://www.hazelcast.com/schema/client-config">
    <group>
        <name>dev</name>
        <password>dev-pass</password>
    </group>
    <network>
        <cluster-members>
            <address>localhost:5701</address>
        </cluster-members>
    </network>
</hazelcast-client>
+1

The best way is to write a Java utility that can be run from the CLI. It can use HazelcastClientto connect to the cluster, get IMAP and print, however you need. Also IMap.getLocalMapStatsgives statistics related to the local map for node.

0
source

Source: https://habr.com/ru/post/1664187/


All Articles