From 4ff29f213700efb7e3ce594d31dc79bfe5d9d1ca Mon Sep 17 00:00:00 2001 From: ZHAO Yijun Date: Wed, 15 Aug 2018 17:06:02 +0800 Subject: [PATCH] fix vgo build and modify readme (#9) * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * fix vgo build * Update Makefile * Update README.md * Update README.md --- Makefile | 15 ++++++++++++--- README.md | 42 ++++++++++++++++++++++++++++++++++-------- 2 files changed, 46 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index f0f53ef..5ea2d5f 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,16 @@ all:install -GOPATH:=$(CURDIR)/../../../../ -export GOPATH +# FIXME: When this issue is done(https://github.com/golang/go/issues/23965#issuecomment-409232583) +# Determine the compiler and version +COMPILER_HELP := $(shell $(CC) --help | head -n 1) +ifneq (,$(findstring clang,$(COMPILER_HELP))) + COMPILER = clang +else ifneq (,$(findstring gcc,$(COMPILER_HELP))) + COMPILER = gcc +else + COMPILER = unknown +endif + test: go version @@ -15,4 +24,4 @@ pytest:install ./tests/run_test.sh install: - vgo install github.com/douban/gobeansdb + CC=$(COMPILER) vgo install ./ diff --git a/README.md b/README.md index 8f23478..6e8bf65 100644 --- a/README.md +++ b/README.md @@ -4,17 +4,23 @@ Yet anonther distributed key-value storage system from Douban Inc. Any memcached client cache interactive with GobeansDB without any modification. +## Related + +- [libmc](https://github.com/douban/libmc) : a high performance python/go mc client +- [gobeansproxy](https://github.com/douban/gobeansproxy) : routing to gobeansdb cluster with three copy +- beansdbadmin(coming soon): webUI, sync ... + ## Prepare GoBeansDB use `vgo` manage dependencies, please install [vgo](https://godoc.org/golang.org/x/vgo) first. +Supported Go version: 1.10.1+ ## Install ```shell -$ cd ${GOPATH} -$ git clone http://github.com/douban/gobeansdb.git src/github.com/douban/gobeansdb -$ cd src/github.com/douban/gobeansdb +$ git clone http://github.com/douban/gobeansdb.git +$ cd gobeansdb $ make ``` @@ -56,14 +62,30 @@ mc.get("foo") ``` mc_client --- cache | - --- any beansdb proxy(即将开源) -- beansdb servers + --- any beansdb proxy -- beansdb servers ``` - 用于单个 key 并发写很少的数据 -- proxy 负责路由, 固定 3 副本 +- [gobeansproxy](https://github.com/douban/gobeansproxy) 负责路由, 固定 3 副本 - 两个集群: 分别存储 图片类 (cache 为 CDN) 和 长文本 (cache 为 mc 集群)。 - 支持离线 [dpark](https://github.com/douban/dpark) 读写,读支持本地化。 - 可以视情况保留一段时间完整的写记录。 +- 借助 python 脚本 管理,近期整理后会部分开源,包 admin UI(readonly),同步脚本等 + + +磁盘上的样子(256分区): + +* /var/lib/beansdb + * 0/ + * 0/ -> /data1/beansdb/0/0 + * 000.data + * 000.000.idx.s + * 000.001.idx.s + * ... + * 008.000.idx.hash + * ... + * 009.data + * 009.000.idx.s ## 入坑指南 @@ -76,14 +98,15 @@ mc_client --- cache 缺点/注意 -1. 一致性支持较弱,时间戳目前是秒级(受限与数据文件格式)。 +1. 一致性支持较弱,时间戳目前是秒级(受限于数据文件格式)。 2. 全内存索引,有一定内存开销,在启动载入索引略慢(约十几秒到半分钟, 决定于key 数量)。 3. 数据文件格式的 padding 对小 value 有一定浪费。 -配置重点 + +配置重点(详见 wiki) - 分桶数 -- htree 高度(决定 merkle tree 部分内存大小) +- htree 高度(决定 merkle tree 部分内存大小和 溢出链表的平均长度) ## 与 [beansdb](https://github.com/douban/beansdb) 关系 @@ -97,3 +120,6 @@ mc_client --- cache - 内存开销变小 - hint 文件格式和后缀变了 - 同一个节点不同数据文件不在混部署,以避免坏一个损失整个点数据 + + +# 一些设计/实现要点见 [wiki](https://github.com/douban/gobeansdb/wiki)