{"id":21113449,"url":"https://github.com/thoainguyen/mtikv","last_synced_at":"2025-07-01T12:03:49.915Z","repository":{"id":144232106,"uuid":"199162956","full_name":"thoainguyen/mtikv","owner":"thoainguyen","description":"Build a distributed transactional key-value database","archived":false,"fork":false,"pushed_at":"2019-09-25T05:05:27.000Z","size":219162,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-01T12:03:27.979Z","etag":null,"topics":["distributed-database","mvcc","raft-consensus-algorithm","transaction"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thoainguyen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-07-27T12:37:24.000Z","updated_at":"2024-11-04T11:29:22.000Z","dependencies_parsed_at":null,"dependency_job_id":"6c120244-83c2-4a93-9c8c-a106f12fe4bb","html_url":"https://github.com/thoainguyen/mtikv","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/thoainguyen/mtikv","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thoainguyen%2Fmtikv","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thoainguyen%2Fmtikv/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thoainguyen%2Fmtikv/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thoainguyen%2Fmtikv/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thoainguyen","download_url":"https://codeload.github.com/thoainguyen/mtikv/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thoainguyen%2Fmtikv/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262959563,"owners_count":23391057,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["distributed-database","mvcc","raft-consensus-algorithm","transaction"],"created_at":"2024-11-20T01:43:55.393Z","updated_at":"2025-07-01T12:03:49.809Z","avatar_url":"https://github.com/thoainguyen.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MTiKV\n\nMini [TiKV](https://github.com/tikv/tikv): A Distributed transactional key-value database\n\n## Architecture\n\n### Overall\n\n\u003cdiv align=\"center\"\u003e\u003cimg src=\"./docs/images/mtikv.png\" width=\"600\"/\u003e\u003c/div\u003e\n\n\n### Mtikv instance\n\n\u003cdiv align=\"center\"\u003e\n\u003cimg src=\"./docs/images/one-instance.png\" width=\"350\"/\u003e\n\u003c/div\u003e\n\n\n### Raft Group\n\n\u003cdiv align=\"center\"\u003e\u003cimg src=\"./docs/images/mtikv-raft-group.png\" width=\"500\"/\u003e\u003c/div\u003e\n\n\n## Flow\n\n### TxnKV\n\n\u003cdiv align=\"center\"\u003e\u003cimg src=\"./docs/images/txnkvflow.png\" width=\"500\"/\u003e\u003c/div\u003e\n\n\n### RawKV\n\n\u003cdiv align=\"center\"\u003e\u003cimg src=\"./docs/images/rawkvflow.png\" width=\"420\"/\u003e\u003c/div\u003e\n\n## Getting Started\n\n### Prerequisites\n\n* **Go**: https://golang.org/doc/install\n\n* **RocksDB:**\n    1. Clone repo `Rocksdb`:\n\n    ```sh\n    $ cd /home/$USER/Downloads\n    $ git clone https://github.com/facebook/rocksdb.git\n    ```\n\n    2. Follow [THIS GUIDE](https://github.com/facebook/rocksdb/blob/master/INSTALL.md) to install rocksdb\n\n* **Gorocksdb:**\n\n    1. Set CGO variable\n\n    ```sh\n    export CGO_CFLAGS=\"-I/home/$USER/Downloads/rocksdb/include\"\n    export CGO_LDFLAGS=\"-L/home/$USER/Downloads/rocksdb  -lrocksdb -lstdc++ -lm -lz -lbz2 -lsnappy -llz4 -lzstd\"\n    ```\n    2. Get library\n    ```sh\n    \n    $ go get github.com/tecbot/gorocksdb\n    ```\n\n### Installing\n\n* **Clone mtikv into workspace:**\n    ```sh\n    $ cd ~/go/src/github.com \u0026\u0026 mkdir thoainguyen \u0026\u0026 cd thoainguyen\n    $ git clone https://github.com/thoainguyen/mtikv\n    $ cd mtikv\n    ```\n\n## Deployment\n\n\n\n### 1. Run PD:\n\n```sh\n$ cd cmd/pd\n$ go run server.go\n```\n\n### 2. Run Mtikv_cli:\n\n```sh\n$ cd cmd/mtikv_cli\n$ go run server.go\n```\n\n### 3. Run Mtikv (4 instance):\n\n#### 3.1 Option 1: Run each instance\n\n```sh\n$ cd cmd/mtikv\n$ go run server.go --node 1\n$ go run server.go --node 2 // in another shell\n$ go run server.go --node 3 // in another shell\n$ go run server.go --node 4 // in another shell\n```\n\n#### 3.2 Option 2: Run via goreman\n\nFirst install [goreman](https://github.com/mattn/goreman), which manages Procfile-based applications.\n\nThe [Procfile](./cmd/mtikv/Procfile) script will set up a local mtikv cluster. Start it with:\n\n```sh\n$ goreman start\n```\n\n### 4. Run Client (CLI)\n\n```sh\n$ cd cmd/client\n$ go run client.go\n```\n\n## Usage:\n\n```sh\n$ go run client.go\n$ set \u003ckey\u003e \u003cvalue\u003e\n$ get \u003ckey\u003e\n$ del \u003ckey\u003e\n$ begin    // new transaction\n$ commit   // commit transaction\n$ rollback // rollback transaction\nCtr+C to exit\n```\n\n\n## Authors\n\n* **Nguyen Huynh Thoai** - *Maintainer* - [thoainguyen](https://github.com/thoainguyen)\n\n## License\n## Acknowledgments\n\n* Mentor @thuyenpt\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthoainguyen%2Fmtikv","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthoainguyen%2Fmtikv","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthoainguyen%2Fmtikv/lists"}