Verify Cluster Status

Check the cluster status and connect to the cluster

We are currently refactoring our documentation. Please excuse any problems you may find and report them here.

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 https://download.pingcap.org/tikv-client-java-3.1.0-SNAPSHOT.jar
    curl -o slf4j-api.jar https://repo1.maven.org/maven2/org/slf4j/slf4j-api/1.7.16/slf4j-api-1.7.16.jar
    
  2. Install jshell (include in JDK >= 9)

  3. Try put and get RawKV API

    Save the following script to file verify_tikv.java.

    import java.util.*;
    import org.tikv.common.TiConfiguration;
    import org.tikv.common.TiSession;
    import org.tikv.raw.RawKVClient;
    import org.tikv.shade.com.google.protobuf.ByteString;
    
    TiConfiguration conf = TiConfiguration.createRawDefault("127.0.0.1:2379");
    TiSession session = TiSession.create(conf);
    RawKVClient client = session.createRawClient();
    
    // put
    client.put(ByteString.copyFromUtf8("key"), ByteString.copyFromUtf8("Hello, World!"));
    
    // get
    System.out.println(client.get(ByteString.copyFromUtf8("key")).toStringUtf8());
    
  4. Run the test script

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