CLI

LinDB Command-Line Client (hereinafter referred to as cli) is a command line tool that comes with LinDB.

It is used to query data and status of various components in the cluster, as well as cluster management.

./lind-cli -help
Usage of ./lind-cli:
  -endpoint string
        Broker HTTP Endpoint (default "http://localhost:9000")

At present, cli only receives one command line parameter: the endpoint of Broker's HTTP service.

After connecting to the broker node, you can query the relevant status and data by LinQL. Here are some simple examples.

For more details, see LinQL.

You can quickly browse the LinQL executed before through the up/down direction-key.

Cli Start-Up
./lind-cli
Welcome to the LinDB.
Server version: 0.0.1
lin@localhost:9000>
Show Databases
lin@localhost:9000> show databases;
+-----------+
| Database  |
+-----------+
| _internal |
+-----------+
1 rows in sets (4.218862ms)
Show Schemas
lin@localhost:9000> show schemas;
+-----------+----------------+------------------------------------------------------------------------+
| Name      | Storage        | Desc                                                                   |
+-----------+----------------+------------------------------------------------------------------------+
| _internal | /lindb-cluster | create database _internal with shard 1, replica 1, intervals [10s->1M] |
+-----------+----------------+------------------------------------------------------------------------+
1 rows in sets (7.747045ms)
Cluster Status
  • Show Master's Status
lin@localhost:9000> show master;
+-------------+---------------------+
| Desc        | Value               |
+-------------+---------------------+
| Elect Time  | 2022-05-15 16:52:48 |
| Online Time | 2022-05-15 16:52:48 |
| Host IP     | 192.168.0.112       |
| Host Name   | woker0              |
| HTTP Port   | 9000                |
| GRPC Port   | 9001                |
+-------------+---------------------+
1 rows in sets (4.675873ms)
  • Show status of Alive Broker
lin@localhost:9000> show broker alive;
+---------------------+---------------+-----------+-----------------+---------+
| Online time         | Host IP       | Host Name | Port(HTTP/GRPC) | Version |
+---------------------+---------------+-----------+-----------------+---------+
| 2022-05-15 16:52:48 | 192.168.0.112 | worker0   | 9000/9001       | 0.0.1   |
+---------------------+---------------+-----------+-----------------+---------+
1 rows in sets (1.38066ms)
Querying from Database
  • Switch Database
lin@localhost:9000> use _internal;
Database changed(current:_internal)
  • Show Metrics
lin@localhost:9000> show metrics;
+----------------------------------------------------+
| Metric                                             |
+----------------------------------------------------+
| lindb.broker.database.write                        |
| lindb.broker.family.write                          |
| lindb.broker.query                                 |
|                      ......                        |
| lindb.traffic.tcp                                  |
| lindb.tsdb.shard                                   |
| lindb.tsdb.shard.indexdb_flush_duration            |
| lindb.tsdb.shard.memdb_flush_duration              |
+----------------------------------------------------+
50 rows in sets (6.495605ms)
  • Show Fields of a specified metric
lin@localhost:9000> show fields from lindb.tsdb.shard;
+-----------------------------+-------+
| Name                        | Type  |
+-----------------------------+-------+
| write_metrics_failures      | sum   |
| active_memdbs               | gauge |
| lookup_metric_meta_failures | sum   |
| write_metrics               | sum   |
| write_batches               | sum   |
| write_fields                | sum   |
| memdb_total_size            | gauge |
| memdb_flush_failures        | sum   |
| indexdb_flush_failures      | sum   |
| active_families             | gauge |
+-----------------------------+-------+
10 rows in sets (7.448755ms)
  • Show Tag Keys of a specified metric
lin@localhost:9000> show tag keys from lindb.tsdb.shard;
+-----------+
| Tag Key   |
+-----------+
| db        |
| namespace |
| node      |
| role      |
| shard     |
+-----------+
5 rows in sets (7.065156ms)
  • Show TagKey's Values of a specified metric.
lin@localhost:9000> show tag values from lindb.tsdb.shard with key='db';
+-----------+
| Tag Value |
+-----------+
| _internal |
+-----------+
1 rows in sets (5.984711ms)
  • Show Metric Data of a specified metric.
lin@localhost:9000> select write_fields from lindb.tsdb.shard where time>now()-2m group by db,node;
+-----------+--------------------+---------------------+--------------+
| db        | node               | timestamp           | write_fields |
+-----------+--------------------+---------------------+--------------+
| _internal | 192.168.0.112:2891 | 2022-05-15 17:05:50 |         1061 |
| _internal | 192.168.0.112:2891 | 2022-05-15 17:06:00 |         1805 |
| _internal | 192.168.0.112:2891 | 2022-05-15 17:06:10 |         1806 |
| _internal | 192.168.0.112:2891 | 2022-05-15 17:06:20 |         1805 |
| _internal | 192.168.0.112:2891 | 2022-05-15 17:06:30 |         1805 |
| _internal | 192.168.0.112:2891 | 2022-05-15 17:06:40 |         1807 |
| _internal | 192.168.0.112:2891 | 2022-05-15 17:06:50 |         1807 |
| _internal | 192.168.0.112:2891 | 2022-05-15 17:07:00 |         1807 |
| _internal | 192.168.0.112:2891 | 2022-05-15 17:07:10 |         1805 |
| _internal | 192.168.0.112:2891 | 2022-05-15 17:07:20 |         1806 |
| _internal | 192.168.0.112:2891 | 2022-05-15 17:07:30 |         1807 |
| _internal | 192.168.0.112:2891 | 2022-05-15 17:07:40 |         1807 |
| _internal | 192.168.0.112:2891 | 2022-05-15 17:07:50 |         1811 |
+-----------+--------------------+---------------------+--------------+
1 rows in sets (8.235714ms)