Verify Cluster Status

Check the cluster status and connect to the cluster

After a TiKV cluster is deployed, you need to check whether the cluster is up and running. This document introduces how to check the cluster status using TiUP and Grafana, and how to connect to the TiKV cluster using a TiKV client to do simple put and get operations.

Check the TiKV cluster status

This section describes how to check the TiKV cluster status using TiUP commands and Grafana.

Use TiUP

Use the tiup cluster display <cluster-name> command to check the cluster status. For example:

tiup cluster display tikv-test

Expected output: If the Status information of each node is Up, the cluster runs normally.

Use Grafana

  1. Log in to the Grafana monitoring at ${Grafana-ip}:3000. The default username and password are both admin.

  2. To check the TiKV port status and load monitoring information, click Overview.

Connect to TiKV and do simple operations

This section describes how to connect to the TiKV cluster to do simple put and get operations.

  1. Download jars

    curl -o tikv-client-java.jar
    curl -o slf4j-api.jar
  2. Install jshell (include in JDK >= 9)

  3. Try put and get RawKV API

    Save the following script to file

    import java.util.*;
    import org.tikv.common.TiConfiguration;
    import org.tikv.common.TiSession;
    import org.tikv.raw.RawKVClient;
    TiConfiguration conf = TiConfiguration.createRawDefault("");
    TiSession session = TiSession.create(conf);
    RawKVClient client = session.createRawClient();
    // put
    client.put(ByteString.copyFromUtf8("key"), ByteString.copyFromUtf8("Hello, World!"));
    // get
  4. Run the test script

    jshell --class-path tikv-client-java.jar:slf4j-api.jar --startup
    Hello, World!