NetApp Closes Acquisition of Instaclustr Read the announcement

Connect to Apache ZooKeeper Using Command Line

zkCli.sh is a utility to connect to a local or remote ZooKeeper service and execute some commands. This article describes how zkCli.sh can be used to connect to clusters in Instaclustr. In this article, we assume that your cluster has been set up and provisioned properly as shown in our previous tutorial “Creating a Cluster”.

Table of Contents

Prerequisites

You also need ZooKeeper binaries which can be downloaded from https://zookeeper.apache.org/releases.html. We recommend a matching ZooKeeper binaries version with your ZooKeeper cluster. You don’t have to install after downloading and extracting.

The public IP address of your machine must be added to the ZooKeeper Allowed Addresses under Firewall Rules in the navigation menu of your cluster in the Instaclustr console. (Refer this support article).

Username, password and certificate file can be found on the Connection Info page of your cluster. Certificate files are required to connect to your cluster with SSL.

Screenshot of Zookeeper Certificate Location

User Authentication

Apache ZooKeeper does not enforce authentication. Users can always connect to ZooKeeper servers as a “world” user.  However, access to the data (znodes) can be limited by ACL that are associated with an authenticated user. We provide a default user that you can opt to use when connecting to the ZooKeeper servers. If you decide to do so, create a file containing the credential (e.g., jaas.conf) with the following content

Client {
   org.apache.zookeeper.server.auth.DigestLoginModule required
   username="iczookeeper"
   password="<password>";
};

and set the environment variable before connecting as described in the following sections.

Connecting to Instaclustr without SSL

If encryption is not enabled in your cluster, you can connect to it using zkCli.sh without SSL.

For Mac/Linux, open your terminal and use the following command to connect to your cluster.

bin/zkCli.sh -server <public_ip_of_your_node>:2181

If you opt to provide credential, set the following environment variable.

export CLIENT_JVMFLAGS="-Djava.security.auth.login.config=jaas.conf"

Connecting to Instaclustr with SSL

If encryption is enabled in your cluster, SSL is needed for connecting to the cluster and you need to get the truststore.jks from the cluster certificate.

For Mac/Linux, open your terminal and using the following command, set the environment variable.

export CLIENT_JVMFLAGS="
-Dzookeeper.clientCnxnSocket=org.apache.zookeeper.ClientCnxnSocketNetty
-Dzookeeper.client.secure=true
-Dzookeeper.ssl.trustStore.location=truststore.jks
-Dzookeeper.ssl.trustStore.password=instaclustr"

Connect to the cluster.

bin/zkCli.sh -server <public_ip_of_your_node>:2182

If you opt to provide credential, add the following flag to the the environment variable before connecting

export CLIENT_JVMFLAGS="${CLIENT_JVMFLAGS} -Djava.security.auth.login.config=jaas.conf"
By Instaclustr Support
Need Support?
Experiencing difficulties on the website or console?
Already have an account?
Need help with your cluster?
Contact Support
Why sign up?
To experience the ease of creating and managing clusters via the Instaclustr Console
Spin up a cluster in minutes