{"id":18449457,"url":"https://github.com/lim-yoona/ymdb","last_synced_at":"2025-10-09T07:35:58.497Z","repository":{"id":206422106,"uuid":"716446034","full_name":"lim-yoona/ymdb","owner":"lim-yoona","description":"ymdb is a simple distributed key-value storage system.","archived":false,"fork":false,"pushed_at":"2024-02-17T14:58:51.000Z","size":152,"stargazers_count":5,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-08T01:34:53.581Z","etag":null,"topics":["database","distributed-systems","go","golang","golang-application","grpc","kv-store","raft","skiplist","store-systems","yaml-configuration"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lim-yoona.png","metadata":{"files":{"readme":"README-CN.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":"2023-11-09T06:39:55.000Z","updated_at":"2024-04-19T07:05:43.000Z","dependencies_parsed_at":"2023-11-12T09:24:12.931Z","dependency_job_id":"41cf028a-3b68-4ca8-9873-910797c32290","html_url":"https://github.com/lim-yoona/ymdb","commit_stats":null,"previous_names":["lim-yoona/tinykvstore","lim-yoona/ymdb"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/lim-yoona/ymdb","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lim-yoona%2Fymdb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lim-yoona%2Fymdb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lim-yoona%2Fymdb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lim-yoona%2Fymdb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lim-yoona","download_url":"https://codeload.github.com/lim-yoona/ymdb/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lim-yoona%2Fymdb/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279000955,"owners_count":26082973,"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","status":"online","status_checked_at":"2025-10-09T02:00:07.460Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["database","distributed-systems","go","golang","golang-application","grpc","kv-store","raft","skiplist","store-systems","yaml-configuration"],"created_at":"2024-11-06T07:20:12.054Z","updated_at":"2025-10-09T07:35:58.468Z","avatar_url":"https://github.com/lim-yoona.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ymdb\n简体中文 | [English](README.md)\n\n_**ymdb** 是一个简易的分布式键值存储系统。_ \n\n**ymdb** 在内存中维护一个跳表用于加快键的检索，并将值存储在磁盘上的WAL文件中。 \n\n你可以在一个集群上运行 **ymdb** ， **分布式 ymdb** 使用 `raft` 协议来实现 **分布式共识** ，同时使用一致性哈希算法来实现 **数据分区和负载均衡**。 \n\n**ymdb** 也保证 **崩溃一致性**。\n\n## 架构\n\n[![架构](https://s11.ax1x.com/2024/02/17/pFJnTYQ.jpg)](https://imgse.com/i/pFJnTYQ)\n\n## 配置\n在运行 ymdb 之前, 你需要准备一些目录:\n\n1. wal 文件目录: 你可以在 `./config/ymDB.yaml` 中设置 wal 文件目录或者在执行 `main` 时通过 flags 设置 wal 文件目录(例如 `./main --store_file_path ./wal/store --restore_file_path ./wal/restore`)。  \n2. raft 数据目录: 你可以在执行 `main` 时通过 flags 设置 raft 数据目录(例如 `./main --raft_data_dir ./ymdb-cluster`)。\n   \n了解目录组织和设置的更多细节, 请参考 [example](https://github.com/lim-yoona/ymdb/tree/main/example) 文件夹下的示例。\n\n## 使用\n\n## 集群上的 ymdb\n[example](https://github.com/lim-yoona/ymdb/tree/main/example) 文件夹下提供了在集群上运行 **ymdb** 的示例:\n\n在 ymdb 项目文件夹下执行如下脚本来启动一个 **ymdb 集群** :  \n```shell\n./example/run_ymdb_cluster.sh\n```\n\n现在你在一个拥有 3 个分区的 9 节点集群上运行了 ymdb 。\n\n然后你可以执行如下脚本运行一个集群客户端来与 **ymdb 集群** 交互：\n```shell\n./example/run_cluster_client.sh\n```\n\n## 单机上的 ymdb\n### 通过 Docker 镜像\n\n首先，使用如下命令来拉取 **ymdb 服务端** 的 Docker 镜像：\n\n```shell\ndocker pull yoonamessi/ymdb:0.1\n```\n\n然后，使用如下命令来运行一个 Docker 容器：\n\n```shell\ndocker run -v ${your_host_store_path}:${path_in_ymDB.yaml} -v ${your_host_restore_path}:${path_in_ymDB.yaml} -p ${host_port}:${port_in_ymDB.yaml} -d  ymdb:0.1\n```\n这是一个示例:  \n```shell\ndocker run -v /root/ymdbdata/walDir/store:/root/ymdb/walDir/store -v /root/ymdbdata/walDir/restore:/root/ymdb/walDir/restore -p 8099:8099 -d  ymdb:0.1\n```\n运行如下命令来启动一个 **ymdb 客户端** (注意，客户端连接的端口必须与容器向主机暴露的端口一致):  \n```shell\ngo run ymDB-cli.go\n```\n\n现在你就可以通过 **ymdb 客户端** 来操作 ymdb 了。\n\n\n## 目前支持的操作\n使用 `put [key] [value]` 来存储一个 KV 对。  \n使用 `get [key]` 来获取 key 对应的 value 。  \n使用 `delete [key]` 来删除一个 KV 对.\n\n\n\n## 单机上的压测\n基准测试的结果或许有点奇怪，因为目前的设计中 put 不必等待 ymdb 返回，而 get 需要获得查询结果，而且通信中也有开销。\n```shell\ngoos: windows\ngoarch: amd64\npkg: github.com/lim-yoona/ymdb/benchmark\ncpu: 12th Gen Intel(R) Core(TM) i7-12650H\nBenchmarkPutGet\nBenchmarkPutGet/put\nBenchmarkPutGet/put-16            339727              2994 ns/op            2392 B/op         40 allocs/op\nBenchmarkPutGet/get\nBenchmarkPutGet/get-16            915457              2891 ns/op            2186 B/op         37 allocs/op\nPASS\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flim-yoona%2Fymdb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flim-yoona%2Fymdb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flim-yoona%2Fymdb/lists"}