Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/thoainguyen/mtikv
Build a distributed transactional key-value database
https://github.com/thoainguyen/mtikv
distributed-database mvcc raft-consensus-algorithm transaction
Last synced: about 5 hours ago
JSON representation
Build a distributed transactional key-value database
- Host: GitHub
- URL: https://github.com/thoainguyen/mtikv
- Owner: thoainguyen
- Created: 2019-07-27T12:37:24.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-09-25T05:05:27.000Z (about 5 years ago)
- Last Synced: 2024-06-20T05:16:50.305Z (5 months ago)
- Topics: distributed-database, mvcc, raft-consensus-algorithm, transaction
- Language: Go
- Homepage:
- Size: 209 MB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# MTiKV
Mini [TiKV](https://github.com/tikv/tikv): A Distributed transactional key-value database
## Architecture
### Overall
### Mtikv instance
### Raft Group
## Flow
### TxnKV
### RawKV
## Getting Started
### Prerequisites
* **Go**: https://golang.org/doc/install
* **RocksDB:**
1. Clone repo `Rocksdb`:```sh
$ cd /home/$USER/Downloads
$ git clone https://github.com/facebook/rocksdb.git
```2. Follow [THIS GUIDE](https://github.com/facebook/rocksdb/blob/master/INSTALL.md) to install rocksdb
* **Gorocksdb:**
1. Set CGO variable
```sh
export CGO_CFLAGS="-I/home/$USER/Downloads/rocksdb/include"
export CGO_LDFLAGS="-L/home/$USER/Downloads/rocksdb -lrocksdb -lstdc++ -lm -lz -lbz2 -lsnappy -llz4 -lzstd"
```
2. Get library
```sh
$ go get github.com/tecbot/gorocksdb
```### Installing
* **Clone mtikv into workspace:**
```sh
$ cd ~/go/src/github.com && mkdir thoainguyen && cd thoainguyen
$ git clone https://github.com/thoainguyen/mtikv
$ cd mtikv
```## Deployment
### 1. Run PD:
```sh
$ cd cmd/pd
$ go run server.go
```### 2. Run Mtikv_cli:
```sh
$ cd cmd/mtikv_cli
$ go run server.go
```### 3. Run Mtikv (4 instance):
#### 3.1 Option 1: Run each instance
```sh
$ cd cmd/mtikv
$ go run server.go --node 1
$ go run server.go --node 2 // in another shell
$ go run server.go --node 3 // in another shell
$ go run server.go --node 4 // in another shell
```#### 3.2 Option 2: Run via goreman
First install [goreman](https://github.com/mattn/goreman), which manages Procfile-based applications.
The [Procfile](./cmd/mtikv/Procfile) script will set up a local mtikv cluster. Start it with:
```sh
$ goreman start
```### 4. Run Client (CLI)
```sh
$ cd cmd/client
$ go run client.go
```## Usage:
```sh
$ go run client.go
$ set
$ get
$ del
$ begin // new transaction
$ commit // commit transaction
$ rollback // rollback transaction
Ctr+C to exit
```## Authors
* **Nguyen Huynh Thoai** - *Maintainer* - [thoainguyen](https://github.com/thoainguyen)
## License
## Acknowledgments* Mentor @thuyenpt