Getting started

Requirements

NSDb runs on Linux and Mac OS X. To be able to execute an existing NSDb installation, the only requirement is:

Get Binaries

All NSDb releases are managed and listed here.
Every Release provides the binaries zip as an asset.
In order to run the project, it is necessary to unzip the archive and start it.

$ wget https://github.com/radicalbit/NSDb/releases/download/1.0.0/nsdb-1.0.0.zip
$ unzip nsdb-1.0.0.zip
$ cd nsdb-1.0.0/bin
$ ./nsdb-cluster

At the end of the process, the following lines should be logged if everything went fine

INFO [NSDb-akka.actor.default-dispatcher-27]  - GrpcEndpoint started on interface 0.0.0.0 on port 7817
INFO [NSDb-akka.actor.default-dispatcher-16]  - Cluster Apis started with http protocol at interface 0.0.0.0 and port 9000

It means that the GrpcEndpoint is correctly started at port 7817 as well as the http endpoint at port 9000.

Working Docker

It is possible to pull NSDb Docker image from Docker Hub

It’s possible to run a container overriding the env variable:

version: '3'

services:

    nsdb:
      image: weareradicalbit/nsdb:1.0.0
      environment:
        NODE_HOSTNAME: 127.0.0.1
      ports:
        - 9010:9000
        - 9000:7817

It’s also possible to run an NSDb container mounting the configuration, data, certificates and external library directories:

version: '3'

services:

    nsdb:
      image: weareradicalbit/nsdb:1.0.0
      volumes:
        - .conf:/opt/nsdb-cluster/conf
        - /host/data/path:/opt/nsdb-cluster/data
        - /host/ext-lib/path:/opt/nsdb-cluster/ext-lib
        - /host/certs/path:/opt/certs
      ports:
        - 9000:9000
        - 7817:7817
        - 9443:9443

To start NSDb container the previous code snippets can be separately put inside a docker-compose.yml file before run the following command:

$ docker-compose up

If everything went good, by executing a docker ps you should be able to see an output like the following.

CONTAINER ID        IMAGE                        
1f31ff8f26d8        weareradicalbit/nsdb:1.0.0

In order to launch the CLI, the following command must be executed

Command Line Interface(CLI) can be launched executing:

$ docker exec -it [CONTAINER_ID] ./bin/nsdb-cli --database database_name

For a comprehensive documentation regarding NSDb CLI refer to CLI doc.

Kubernetes

Using the above mentioned docker images, it is possible to deploy a NSDb cluster in a k8s environment.
Since of course, we are dealing with a stateful application, the following entities must be deployed:

k8s Statefulset example

Build from source and Launch

In order to build the project from source, apart from Java, sbt 1.x.x (or higher) is required.

git clone https://github.com/radicalbit/NSDb
cd NSDb

After a project clone , it is possible to package the project using sbt with command dist:

$ sbt dist

(please note that this command might take a while, because many dependencies must be retrieved.)

Once project packaging is completed, unzip archive created in path : package.

$ cd package
$ unzip nsdb-[VERSION].zip
$ cd nsdb-[VERSION]/bin
$ ./nsdb-cluster

In order to check if the application is up and running properly user can call health-check API:

$ curl -f "http://localhost:9000/status"
RUNNING

Command Line Interface(CLI) can be launched executing in the same path:

$ ./nsdb-cli --host 127.0.0.1 --port 7817 --database database_name

For a comprehensive documentation regarding NSDb CLI refer to CLI doc.

Debian native package

It is possible to create a native Debian package of the project using sbt with command deb:

$ sbt deb

Once project packaging is completed, deb package could be found in path : package.

$ cd package
$ dpkg --install nsdb_1.0.0-SNAPSHOT_all.deb
$ nsdb-cluster

Command Line Interface(CLI) can be launched executing in the same path:

$ nsdb-cli --host 127.0.0.1 --port 7817 --database database_name

Centos/RHEL native package

It is possible to create a native Centos/RHEL package of the project using sbt with command rpm:

$ sbt rpm

Once project packaging is completed, rpm package could be found in path : package.

$ cd package
$ yum install nsdb-1.0.0-1.noarch.rpm
$ nsdb-cluster

Command Line Interface(CLI) can be launched executing in the same path:

$ nsdb-cli --host 127.0.0.1 --port 7817 --database database_name

Next steps

NSDb exposes data retrieval and insertion using both:

Query subscription can be achieved making use of WebSocket APIs.

Privacy Policy Radicalbit S.r.l. • VAT IT09292580967‬