vaccovecrana / vephar

Minimal K/V store with API and Dashboard

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

vephar

vephar is a minimal K/V store with an API and a dashboard using:

Usage

3 node cluster:

Nodes in the cluster identify with the following format:

IPV4_ADDRESS:RAFT_TCP_PORT:HTTP_PORT

Start node 1:

./vephar -peerId=127.0.0.1:9090:8080 -data=./data0 \
  -join=127.0.0.1:9091:8081,127.0.0.1:9092:8082

Start node 2:

./vephar -peerId=127.0.0.1:9091:8081 -data=./data1 \
  -join=127.0.0.1:9090:8080,127.0.0.1:9092:8082

Start node 3:

./vephar -peerId=127.0.0.1:9092:8082 -data=./data2 \
  -join=127.0.0.1:9090:8080,127.0.0.1:9091:8081,127.0.0.1:9092:8082

Now set a key and a value:

curl -o - 'http://127.0.0.1:8081/kv/set?key=Hello&value=World'
{"Data":"Hello","Error":""}

And rertrieve it:

curl -o - 'http://127.0.0.1:8081/kv/get?key=Hello'
World

This also works for binary data values:

curl --request POST 'http://127.0.0.1:8080/kv/set?key=Hello' \
     --header 'Content-Type: text/plain' \
     --data-binary '@LICENSE'
{"Data":"Hello","Error":""}

Now delete the key:

curl -o - 'http://127.0.0.1:8081/kv/del?key=Hello'
{"Data":"Hello","Error":""}

curl -o - 'http://127.0.0.1:8081/kv/get?key=Hello'
{"Data":null,"Error":"key not found: [Hello]"}

The keys and values defined on server 8081 are also available on servers 8080 and 8082.

These operations can also be done with the integrated web UI:

http://127.0.0.1:8081/ui

vephar-ui

The environment variables VPR_TRACE and VPR_DEBUG can be used to log a node's execution state. The variable values are not read, and the program only checks if they have been defined in the environment.

Similar projects

Disclaimer

This project is not production ready and still requires security and code correctness audits. You use this software at your own risk. Vaccove Crana, LLC., its affiliates and subsidiaries waive any and all liability for any damages caused to you by your usage of this software.

About

Minimal K/V store with API and Dashboard

License:Other


Languages

Language:Go 47.5%Language:TypeScript 42.1%Language:CSS 6.3%Language:SCSS 3.1%Language:JavaScript 0.7%Language:Shell 0.2%