Skip to content

Minimal K/V store with API and Dashboard

License

Notifications You must be signed in to change notification settings

vaccovecrana/vephar

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.