https://github.com/asim/kv
A distributed in-memory key-value store built using hashicorp/memberlist with HTTP API
https://github.com/asim/kv
gossip hashicorp key-value memberlist
Last synced: 5 months ago
JSON representation
A distributed in-memory key-value store built using hashicorp/memberlist with HTTP API
- Host: GitHub
- URL: https://github.com/asim/kv
- Owner: asim
- License: mit
- Created: 2015-10-17T21:18:38.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2025-01-30T21:14:11.000Z (over 1 year ago)
- Last Synced: 2026-01-15T04:52:57.890Z (7 months ago)
- Topics: gossip, hashicorp, key-value, memberlist
- Language: Go
- Homepage:
- Size: 35.2 KB
- Stars: 144
- Watchers: 2
- Forks: 30
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# KV
A distributed in-memory key-value store built using [hashicorp/memberlist](https://github.com/hashicorp/memberlist) with HTTP API
## Install
```shell
go get github.com/asim/kv
```
## Usage
```shell
kv
-nodes="": comma seperated list of nodes
-address=:4001 http server host:port
```
### Create Cluster
Start first node
```shell
kv
```
Make a note of the local node address
```
Local node 192.168.1.64:60496
Listening on :4001
```
Start second node with first node as part of the nodes list
```shell
kv --nodes=192.168.1.64:60496 --address=:4002
```
You should see the output
```
2015/10/17 22:13:49 [DEBUG] memberlist: Initiating push/pull sync with: 192.168.1.64:60496
Local node 192.168.1.64:60499
Listening on :4002
```
First node output will log the new connection
```shell
2015/10/17 22:13:49 [DEBUG] memberlist: TCP connection from: 192.168.1.64:60500
2015/10/17 22:13:52 [DEBUG] memberlist: Initiating push/pull sync with: 192.168.1.64:60499
```
## HTTP API
- **/get** - get a value
- **/set** - set a value
- **/del** - delete a value
Query params expected are `key` and `val`
```shell
# add
curl "http://localhost:4001/set?key=foo&val=bar"
# get
curl "http://localhost:4001/get?key=foo"
# delete
curl "http://localhost:4001/del?key=foo"
```
## HTTP UI
Browse to `localhost:4001` for a simple web form