/CalvinDB

Geo-replicated CalvinDB(Include the original CalvinDB and low latency version)

Primary LanguageC++

------------This is the Geo-replicated CalvinDB codebase (under development)------------

CalvinDB is a scalable transactional database system that leverages determinism to guarantee active replication and full ACID-compliance of distributed transactions without two-phase commit. 

This codebase supports original CavlinDB and low-latency version of CalvinDB.

Installation(This is for Ubuntu 14.04, it should be similar with other Linux distribution):
1. You should install the following softwares:
   Git
   make,g++
   autoconf, libtool,libreadline-dev,libsnappy-dev, pkg-config
   subversion
   unzip, tar


2. You should install the following external libraries:
    --- protobuf
    --- glog
    --- zeromq
    --- gflags

   I wrote a script(install-ext), so that you can directly run this script to download and compile the libraries.


3. After that, you should add the LD_LIBRARY_PATH to the ~/.bashrc, below is my cofig:
export LD_LIBRARY_PATH=~/CalvinDB/ext/zeromq/src/.libs:~/CalvinDB/ext/protobuf/src/.libs:~/CalvinDB/ext/glog/.libs:~/CalvinDB/ext/gflags/.libs

Then run source ~/.bashrc.


4. Now you can compile the code:

$ cd ~/CalvinDB/src
$ make -j

Then all the binaries will be created at ~/CalvinFS/bin/

5. You can change the config file(calvin.conf) to include all machines in the cluster. 
One example config file is below:
0:0:192.168.122.1:10001
1:0:192.168.122.2:10001
2:1:192.168.122.3:10001
3:1:192.168.122.4:10001
4:2:192.168.122.5:10001
5:2:192.168.122.6:10001

First column:   global machine ID;
Second column:  replica ID;
Third column: IP address;
Fourth column: port

This means that we have 3 replicas, and each replica has 2 machines.

6. Now you can run CalvinDB:

$ cd ~/CalvinDB
$ bin/scripts/cluster --command="status" --type=1 // Check the status of the cluster if 6 replicas (type=0 if 3 replicas)
$ bin/scripts/cluster --command="update"  --type=1 // Use git to get the latest code, and compile it on each machine 
$ bin/scripts/cluster --command="put-config" --type=1// Send the config file to all the machines in the cluster

// Run Original CalvinDB with 3 replicas
$ bin/scripts/cluster --command="start" --lowlatency=0 --type=0 --experiment=0  --percent_mp=0  --percent_mr=0  --hot_records=10000 --max_batch_size=100
// Run Original CalvinDB with 6 replicas
$ bin/scripts/cluster --command="start" --lowlatency=0 --type=1 --experiment=0  --percent_mp=0  --percent_mr=0  --hot_records=10000 --max_batch_size=100 

// Run Lowlatency CalvinDB with 3 replicas
$ bin/scripts/cluster --command="start" --lowlatency=1 --type=0 --experiment=0  --percent_mp=0  --percent_mr=0  --hot_records=10000 --max_batch_size=100  
// Run Lowlatency CalvinDB with 6 replicas
$ bin/scripts/cluster --command="start" --lowlatency=1 --type=1 --experiment=0  --percent_mp=0  --percent_mr=0  --hot_records=10000 --max_batch_size=100
// Run Lowlatency CalvinDB with 6 replicas (strong availbility)
$ bin/scripts/cluster --command="start" --lowlatency=1 --type=2 --experiment=0  --percent_mp=0  --percent_mr=0  --hot_records=10000 --max_batch_size=100  

You probably need another terminal to terminate the db process when complete your test by running:
$ bin/scripts/cluster --command="kill" --lowlatency=0  --type=1// lowlatency=0: CalvinDB; lowlatency=1 or 2: Low latency CavlinDB; type=1: 6 replicas; type=0: 3 replicas

Will be continued.