bg
Docker Images – BangDB = NoSQL + AI + Stream

Docker Images

chevron

BangDB Docker Images

The docker images are available publicly for use. it's available at docker hub
There are two ways in which images are created. One, where we have different images for different components of the BangDB, second - single image for BangDB and all other components in an interactive mode.

For various reasons, we should use single image as it allows us to access shell and then we can use it as separate virtual machine. It also has all necessary packages of BangDB and its dependencies installed.

There are two ways to run the BangDB in docker;

1. Single Docker image which will allow user to deal with BangDB interactively [ recommended ]
2. Docker images for Server, cli etc. all separate containers - good when we need to run standalone server in a docker

Option 1. For Single Image [ useful as user can use it like linux box ]

A. Run the docker [ bangdb_ubuntu18 ] docker run --memory="6g" --cpus="4" -it bangdb/bangdb:bangdb_ubuntu18 it will offer shel and user can get in and interact with db using cli etc. User can also run benchmarks, run agent to push data etc. B. Stop the docker docker stop To get CONTAINER_ID, docker ps -a see the id associated with the running image bangdb-server and use it to stop the server
Note: the cpus, memory etc could be changed as required.

Option 2. Different images for different binaries

A. Run the BangDB Server docker run -it --memory="3g" --memory-swap="4g" --cpus="3" -p 0.0.0.0:10101:10101 -d bangdb-server This will start the container and run the bangdb. To stop the container/server, docker stop To get CONTAINER_ID, docker ps -a see the id associated with the running image bangdb-server and use it to stop the server
Now we have server running, but we still need cli to interact. It can be done again using another docker image for cli
B. Run the cli docker run -it bangdb-cli
This will run the cli and you can interact with database. Please see https://bangdb.com/cli-overview/ for overview of the cli and how to use it

BangDB - Get Started with Docker image of the db [ option 1, above ]

Install BangDB

BangDB could be downloaded from https://bangdb.com/download
Please see more info on this at https://bangdb.com/server-install/

Or we could use the docker image to run and test the db. We should take single docker image (bangdb_ubuntu18) from https://hub.docker.com/r/bangdb/bangdb

Note: there are separate images available for BangDB as well which runs individual components of the DB in separate docker containers, however for detail hands on, we should use the single image
To use docker images, pls see https://bangdb.com/docker-images/
Pull BangDB image

> docker pull bangdb/bangdb:bangdb_ubuntu18

Note: you should have docker installed on the machine

Run the docker image

> docker run --memory="6g" --cpus="4" -it bangdb/bangdb:bangdb_ubuntu18

This will run the docker and provide a prompt like following;

root@a7c17d02c51b:/# 

Check the files and folders

root@ccc0a2d4f239:/# ls -l
total 72
drwxrwxr-x  11 1001 1001 4096 Apr 18 23:01 bangdb_2.0_ubuntu18
drwxr-xr-x   2 root root 4096 Mar 25 16:45 bin
drwxr-xr-x   2 root root 4096 Apr 24  2018 boot
drwxr-xr-x   5 root root  360 Apr 19 09:07 dev
drwxr-xr-x   1 root root 4096 Apr 19 09:07 etc
drwxr-xr-x   2 root root 4096 Apr 24  2018 home
-rwxrwxr-x   1 root root   89 Apr 18 22:40 install.sh
drwxr-xr-x   1 root root 4096 Apr 18 22:49 lib
drwxr-xr-x   2 root root 4096 Mar 25 16:45 lib64
drwxr-xr-x   2 root root 4096 Mar 25 16:44 media
drwxr-xr-x   2 root root 4096 Mar 25 16:44 mnt
drwxr-xr-x   2 root root 4096 Mar 25 16:44 opt
dr-xr-xr-x 214 root root    0 Apr 19 09:07 proc
drwx------   1 root root 4096 Apr 18 23:05 root
drwxr-xr-x   1 root root 4096 Apr 18 22:07 run
drwxr-xr-x   1 root root 4096 Apr 18 22:07 sbin
drwxr-xr-x   2 root root 4096 Mar 25 16:44 srv
dr-xr-xr-x  13 root root    0 Apr 19 09:07 sys
drwxrwxrwt   1 root root 4096 Apr 18 23:05 tmp
drwxr-xr-x   1 root root 4096 Mar 25 16:44 usr
drwxr-xr-x   1 root root 4096 Mar 25 16:45 var


Go to bangdb_2.0_ubuntu18 folder

> cd  bangdb_2.0_ubuntu18/

Run the server

root@ccc0a2d4f239:/bangdb_2.0_ubuntu18# ./bangdb-server start
Updating the core-pattern file.. needs admin right for the same
Starting 'bangdb-server-2.0' : Running service in background now
server init done with [ 8 ] workers for server-stage-option 1
               Done
root@ccc0a2d4f239:/bangdb_2.0_ubuntu18# 

This runs the db in background. You can check the db logs using following command;

root@ccc0a2d4f239:/bangdb_2.0_ubuntu18# tail -f bin/data/mydb.applog 
[2021-04-19 09:09:09]:[bangdb_database.cpp:446][INF] table [ 4160012360353312583 : _sys_attr_stats_tbl ] created
[2021-04-19 09:09:09]:[bangdb_stats_manager.cpp:43][INF] successfully init bangdb_stats_manager for schema
[2021-04-19 09:09:10]:[bangdb_database.cpp:446][INF] table [ 418502132675317959 : _sys_entity_table_ ] created
[2021-04-19 09:09:10]:[bangdb_entity_manager.cpp:25][INF] successfully init bangdb_entity_manager for schema
[2021-04-19 09:09:10]:[bangdb_database.cpp:446][INF] table [ 487512192128988132 : _sys_stream_schema_ ] created
[2021-04-19 09:09:10]:[bangdb_database.cpp:446][INF] table [ 7241491142827284587 : _sys_schema_meta_ ] created
[2021-04-19 09:09:10]:[tableenv.cpp:394][ERR] incompatible key type [ 1 ] for primitive table, setting the key_type properly (NORMAL_KEY_LONG)
[2021-04-19 09:09:10]:[bangdb_database.cpp:446][INF] table [ 1743666775485222942 : _sys_stream_meta_ ] created
[2021-04-19 09:09:10]:[bangdb_wrapper.cpp:240][INF] Database auxiliary services also started : mydb
[2021-04-19 09:09:10]:[service.cpp:476][INF] master [0.0.0.0, 10101] with public ip [ 0.0.0.0 ] is up and running in {non-transaction} mode with {replication off} for database = mydb
 
Ctrl+c to stop watching the log.

Run the CLI

We need to interact with the db using cli, hence now we should run it

> cd cli
> ./bangdb-cli-2.0
This will present a prompt and we can start the db operations

image


Please see https://bangdb.com/cli-overview/ for detail CLI commands and operations