geyungjen / matrixkv

This is a distributed kv project to demonstrate how to use matrixcube

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Matrixkv

This is a distributed kv project to demonstrate how to use matrixcube.

Build docker image

make docker

Prepare local data dir

mkdir -p /data/node0
mkdir -p /data/node1
mkdir -p /data/node2
mkdir -p /data/node3

Run with docker-compose

docker-compose up

Set on any node

curl -X POST  -H 'Content-Type: application/json' -d '{"key":"k1","value":"v1"}' http://127.0.0.1:8080/set

curl -X POST  -H 'Content-Type: application/json' -d '{"key":"k2","value":"v2"}' http://127.0.0.1:8081/set

curl -X POST  -H 'Content-Type: application/json' -d '{"key":"k3","value":"v3"}' http://127.0.0.1:8082/set

Get on any node

curl http://127.0.0.1:8080/get?key=k1
curl http://127.0.0.1:8081/get?key=k1
curl http://127.0.0.1:8082/get?key=k1

curl http://127.0.0.1:8080/get?key=k2
curl http://127.0.0.1:8081/get?key=k2
curl http://127.0.0.1:8082/get?key=k2

curl http://127.0.0.1:8080/get?key=k3
curl http://127.0.0.1:8081/get?key=k3
curl http://127.0.0.1:8082/get?key=k3

Delete on any node

curl -X POST  -H 'Content-Type: application/json' -d '{"key":"k1"}' http://127.0.0.1:8080/delete

curl -X POST  -H 'Content-Type: application/json' -d '{"key":"k2"}' http://127.0.0.1:8081/delete

curl -X POST  -H 'Content-Type: application/json' -d '{"key":"k3"}' http://127.0.0.1:8082/delete

About

This is a distributed kv project to demonstrate how to use matrixcube


Languages

Language:Go 76.8%Language:Dockerfile 15.0%Language:Makefile 6.8%Language:Shell 1.4%