CLI Overview
Command Line Interface for BangDB
BangDB Command Line Interface (CLI) allows user to interact with the BangDB in easy and efficient manner. User may perform almost all task using the CLI. The CLI could be used to do several different things in different areas as shown below.
Database
DB related activities, create table, index, put, get scan data etc…
Stream
Stream related, create stream, add CEP, filters, join, draw charts etc…
ML
Train model, test, deploy etc…
BRS
Create bucket, add files, models, etc…
Replication
Add slaves, manage master/ slave, etc…
Agent
Manage agents, add monitoring of resources etc…
Let's go into the details and see how to go about it. But before that few important points:
- The command reads one line at a time; hence we must complete the command in single line. When we press enter, that's when CLI interprets the command.
- The line may not end with ";" (semicolon), "enter" is good enough.
- When data is json and we wish to show them in pretty format, just add "pretty" at the end of the command.
- When we are scanning a table or stream (range query), then we may limit the number of items to be shown by adding “limit n”, where n is the number of rows/events we wish to see at a time. Default value for n is 10.
"_pk"
is used for primary keys in the queries."st"
and"et"
are used for start time and end time in stream queries respectively.- The usual SQL like command is in lower case only, CLI doesn't need upper case for such reserved names/commands.
- There are several commands which creates workflow to complete the process, such as create table, create schema, add index, train model etc…
Run CLI
To run CLI, cd to the directory where the bangdb-cli-2.0 is placed and
./bangdb-cli-2.0
We get something like following:
Now we are ready to interact with the db. We can seek help as we need, you make tell which area help is needed. So for example if help is needed for db, we may type.
help db
Although the CLI offers simple interface and workflow for most of the commands, however there are several commands which may require bit of discussions and they are covered here in detail.