一个 kv 服务: mini-kvstore-go
为自己搭建一个好用的 kv 服务
🕐
方案1
并没有 server 方案,本地,需要自己扩展
方案2
有
server方案,不过, intel 架构,且docker.io timeout问题,需要自己解决
make server
# 存数据
$ curl -X POST http://localhost:9002/blobs/weibo_token -d "wb-tokensdfsdf"
# 取数据
$ curl http://localhost:9002/blobs/weibo_token方案3
基于 mini-kvstore-go 的 fork 版本。
git clone git@github.com:aric-go/mini-kvstore-go.git开启 server
make server使用 Simple KV
# Store
curl -X POST http://localhost:9002/kv/name -d "Alice"
# {"data":{"key":"name","etag":"a1b2c3d4","size":5,"volume_id":"vol-1"},"status":201}
# Fetch
curl http://localhost:9002/kv/name
# {"data":"Alice","status":200}
# Delete
curl -X DELETE http://localhost:9002/kv/name
# {"data":null,"status":200}
# List keys
curl http://localhost:9002/kv
# {"data":["name","email"],"status":200}
# Key not found
curl http://localhost:9002/kv/not-exist
# {"data":"key not found","status":404}带 token的启动
AUTH_TOKEN=mysecret go run cmd/volume-server/main.go带权限的访问
curl -H "Authorization: Bearer mysecret" http://localhost:9002/kv