Cassandra in Go.
- Install Go 1.15
- Enable Go module and Setup Go package proxy
$ go env -w GO111MODULE=on
$ go env -w GOPROXY=https://goproxy.io,direct
- Download
First setup your Go project structure, put the following into your ~/.bashrc
:
export GOPATH=~/projects/go # any where you like, except $GOROOT
export mg=$GOPATH/src/github.com/DistAlchemist
Then make directories:
$ mkdir -p $mg
$ cd $mg
$ git clone https://github.com/DistAlchemist/Mongongo.git
# or git clone [email protected]:DistAlchemist/Mongongo.git
$ cd Mongongo
- Setup tmux for multi-terminal (recommended)
$ sudo apt install tmux
- Create a new session of tmux:
$ tmux new -s mg
- Build files:
$ cd $mg
$ cd Mongongo
$ make
- Inside one terminal, run Mongongo server:
$ bin/mg-server
- Inside another terminal, run command line interface:
$ bin/cli
- To start servers on multiple nodes:
$ sudo chmod +x startallpeers.sh
$ ./startallpeers.sh
- To stop servers on multiple nodes:
$ sudo chmod +x stopallpeers.sh
$ ./stopallpeers.sh
-
The design mostly follows the very early version of Cassandra
-
Currently only simple
SET
andGET
operation is supported:
SET table1.standardCF1['row1']['column1']='value'
GET table1.standardCF1['row1']['column1']
-
The project is roughly divided into three layers:
- Command Line Interface (parse SQL to command)
- Mongongo Server (determine which nodes need to perform the operation, send the operation to their storage layer)
- Storage Layer (perform specific operation, update commitLog, memTable, ssTable etc.)
-
TODO
- Add more tests.
- Strengthen QL support.
- See CONTRIBUTING
MIT License