{"id":26533659,"url":"https://github.com/hslam/raftdb","last_synced_at":"2025-03-21T19:19:21.238Z","repository":{"id":57567191,"uuid":"225919020","full_name":"hslam/raftdb","owner":"hslam","description":"The raftdb implements a simple distributed key-value database, using the raft distributed consensus protocol.","archived":false,"fork":false,"pushed_at":"2023-05-17T14:21:49.000Z","size":71,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-06-20T12:05:50.132Z","etag":null,"topics":["distributed","go","golang","kvdb","raft"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hslam.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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-12-04T17:15:17.000Z","updated_at":"2023-12-20T08:00:16.000Z","dependencies_parsed_at":"2024-06-20T11:15:45.488Z","dependency_job_id":"48f2b9ac-428b-4e27-baf4-c72351a3b8cd","html_url":"https://github.com/hslam/raftdb","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hslam%2Fraftdb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hslam%2Fraftdb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hslam%2Fraftdb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hslam%2Fraftdb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hslam","download_url":"https://codeload.github.com/hslam/raftdb/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244852683,"owners_count":20521160,"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","go","golang","kvdb","raft"],"created_at":"2025-03-21T19:19:20.754Z","updated_at":"2025-03-21T19:19:21.223Z","avatar_url":"https://github.com/hslam.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# raftdb\nThe raftdb implements a simple distributed key-value database, using the [raft](https://github.com/hslam/raft  \"raft\") distributed consensus protocol.\n\n## Get started\n\n### Install\n```\ngo get github.com/hslam/raftdb\n```\n\n### Build\n```\ngo build -o raftdb main.go\n```\n\n#### Three nodes\n```sh\n./raftdb -h=localhost -p=7001 -c=8001 -f=9001 -path=./raftdb.1 \\\n-members=localhost:9001,localhost:9002,localhost:9003\n\n./raftdb -h=localhost -p=7002 -c=8002 -f=9002  -path=./raftdb.2 \\\n-members=localhost:9001,localhost:9002,localhost:9003\n\n./raftdb -h=localhost -p=7003 -c=8003 -f=9003  -path=./raftdb.3 \\\n-members=localhost:9001,localhost:9002,localhost:9003\n```\n\n##### HTTP SET\n```\ncurl -XPOST http://localhost:7001/db/foo -d 'bar'\n```\n\n##### HTTP GET\n```\ncurl http://localhost:7001/db/foo\n```\n\n##### Client example\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"github.com/hslam/raftdb/node\"\n)\n\nfunc main() {\n\tclient := node.NewClient(\"localhost:8001\", \"localhost:8002\", \"localhost:8003\")\n\tkey := \"foo\"\n\tvalue := \"Hello World\"\n\tif ok := client.Set(key, value); !ok {\n\t\tpanic(\"set failed\")\n\t}\n\tif result, ok := client.LeaseReadGet(key); ok \u0026\u0026 result != value {\n\t\tpanic(result)\n\t}\n\tif result, ok := client.ReadIndexGet(key); ok {\n\t\tfmt.Println(result)\n\t}\n}\n```\n\n##### Output\n```\nHello World\n```\n\n### [Benchmark](https://github.com/hslam/raft-benchmark  \"raft-benchmark\")\nRunning on a three nodes cluster.\n##### Write\n\n\u003cimg src=\"https://raw.githubusercontent.com/hslam/raft-benchmark/master/raft-write-qps.png\" width = \"400\" height = \"300\" alt=\"write-qps\" align=center\u003e\u003cimg src=\"https://raw.githubusercontent.com/hslam/raft-benchmark/master/raft-write-p99.png\" width = \"400\" height = \"300\" alt=\"write-p99\" align=center\u003e\n\n##### Read Index\n\n\u003cimg src=\"https://raw.githubusercontent.com/hslam/raft-benchmark/master/raft-read-qps.png\" width = \"400\" height = \"300\" alt=\"read-qps\" align=center\u003e\u003cimg src=\"https://raw.githubusercontent.com/hslam/raft-benchmark/master/raft-read-p99.png\" width = \"400\" height = \"300\" alt=\"read-p99\" align=center\u003e\n\n## License\nThis package is licensed under a MIT license (Copyright (c) 2019 Meng Huang)\n\n## Author\nraftdb was written by Meng Huang.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhslam%2Fraftdb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhslam%2Fraftdb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhslam%2Fraftdb/lists"}