Ever wondered how to quickly take a peek into your Hazelcast structures, for example on a UAT / CIT environment? Look no further! :-) I've recently had a similar task. Debugging an issue on a test environment I reckoned it might be caused by a faulty data in the Hazelcast cluster. Fortunately we can use what comes with a Java application using Hazelcast (in a client mode) - class ClientTestApp.
First of all we're going to need two Hazelcast JARs (here - version 3.2.5):
Both JARs should be copied into empty directory, let's call it "lib" for this demo purposes. Next, a shell script used to run the test app needs to be created:
In order to have the client connect with your cluster, a configuration needs to be provided as well. The file needs to be named hazelcast-client.xml and reside in the same directory as the run.sh script. Sample content looks as follows:
First of all we're going to need two Hazelcast JARs (here - version 3.2.5):
- hazelcast-client-3.2.5.jar
- hazelcast-3.2.5.jar
Both JARs should be copied into empty directory, let's call it "lib" for this demo purposes. Next, a shell script used to run the test app needs to be created:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
java -server -Djava.net.preferIPv4Stack=true -cp ../lib/*:. com.hazelcast.client.examples.ClientTestApp |
In order to have the client connect with your cluster, a configuration needs to be provided as well. The file needs to be named hazelcast-client.xml and reside in the same directory as the run.sh script. Sample content looks as follows:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<hazelcast-client xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://www.hazelcast.com/schema/client-config | |
http://www.hazelcast.com/schema/client-config/hazelcast-client-config-3.2.xsd" | |
xmlns="http://www.hazelcast.com/schema/client-config"> | |
<group> | |
<name>cluster1</name> | |
<password>cluster1pass</password> | |
</group> | |
<network> | |
<cluster-members> | |
<address>127.0.0.1:5701</address> | |
</cluster-members> | |
</network> | |
</hazelcast-client> |
After running the client, you should get a Hazelcast console able to query / manage the cluster. Full manual of the CLI is here: http://docs.hazelcast.org/docs/2.3/manual/html/ch17s09.html
Enjoy querying your data!
Enjoy querying your data!