bg

CLI Overview

chevron

Command Line Interface for BangDB

For Database | BRS | Stream | ML | Agent | Replication |

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.

1. Database – db related activities, create table, index, put, get scan data etc … 2. Stream – stream related, create stream, add CEP, filters, join, draw charts etc… 3. ML – train model, test, deploy etc… 4. BRS – create bucket, add files, models, etc… 5. Replication – add slaves, manage master/ slave, etc… 6. 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.
a. 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 b. The line may not end with ‘;’ (semicolon), ‘enter’ is good enough c. When data is json and we wish to show them in pretty format, just add ‘pretty’ at the end of the command d. 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 e. “_pk” is used for primary keys in the queries f. “st” and “et” are used for start time and end time in stream queries respectively g. The usual SQL like command is in lower case only, CLI doesn’t need upper case for such reserved names/commands h. 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
NOTE: we must keep bangdb.config in the same dir as cli, this is a requirement right now, will get relaxed in some time in next release

We get something like following.

image


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

bangdb > help db

image


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.