Skip to content

tutorial

Boris Glavic edited this page Feb 23, 2017 · 7 revisions

Overview

This tutorial shows how to create 3 node demo deployment of HRDBMS using docker on a *nix system.

Prerequisites

Check out HRDBMS from github

git clone https://github.com/IITDBGroup/HRDBMS.git HRDBMS
cd HRDBMS

Also you need to have docker and docker-compose installed. Make sure that you have at least 4 GB memory allocated for docker.

Start the cluster

Now we spawn a 3 node cluster (one coordinator and two worker nodes) using docker-compose.

cd HRDBMS/docker/DockerCompose/demo/
./hrdbms_start.sh

This may take a while since the system is starting up the cluster and creating the system catalog tables. If you want to see what is happening under the hood you can use the show_coordinator_log.sh or show_worker_log.sh WORKER_NUM to check what each node in the cluster is working on right now (use CTRL-C to stop the log output).

Connect to HRDBMS and run some commands

Run the following command to start an interactive session using HRDBMS's command line client

./hrdbms_client.sh
HRDBMS> 

Before executing any commands we need to connect to the cluster we have created

connect to jdbc:hrdbms://127.0.0.1:3232

Create a table and insert some data (REMARK: currently commands in the CLI are terminated by newline and are not allowed to have a semicolon at the end!).

CREATE TABLE emp (ename VARCHAR(40), salary INTEGER, PRIMARY KEY(ename)) NONE ALL,HASH,{ename} ALL,HASH,{salary}
COMMIT
INSERT INTO emp VALUES ('Peter', 30000)
INSERT INTO emp VALUES ('Bob',10000)
INSERT INTO emp VALUES ('Alice', 5000)

Run your first queries

SELECT * FROM emp
SELECT count(*) AS x FROM emp

The output produced by the whole session should look like this:

HRDBMS> connect to jdbc:hrdbms://127.0.0.1:3232
HRDBMS> CREATE TABLE emp (ename VARCHAR(40), salary INTEGER, PRIMARY KEY(ename)) NONE ALL,HASH,{ename} ALL,HASH,{salary}
1 rows were modified
HRDBMS> COMMIT
HRDBMS> INSERT INTO emp VALUES ('Peter', 30000)
1 rows were modified
HRDBMS> INSERT INTO emp VALUES ('Bob',10000)
1 rows were modified
HRDBMS> INSERT INTO emp VALUES ('Alice', 5000)
1 rows were modified
HRDBMS> COMMIT
HRDBMS> SELECT * FROM emp
EMP.ENAME    EMP.SALARY    
-----------------------
 Peter       30000
 Alice       5000
 Bob         10000
HRDBMS> SELECT count(*) AS x FROM emp
X    
-
 3

HRDBMS> 

Stopping the cluster and restarting HRDBMS

To restart the HRDBMS without restarting the docker containers run

./hrdbms_restart.sh

To shutdown the cluster run

docker-compose stop

you can then restart the cluster with

docker-compose start

Clone this wiki locally