Blazingly fast key-value storage
- Simple interface
- Fault tolerance
- Master-master replication
- Golang 1.10.4
- RabbitMQ 3.6.10
go get github.com/streadway/amqp
go build ./vitamin.go
./vitaminStore "test_key" for 60 seconds
nc localhost 8080
set("test_key","test value",60)
test valueGet "test_key"
get("test_key")
test valueIt is easy to distribute work between several instances of Vitamin located at different servers with help of out of the box Master-Master replication.
Let's suppose we have four severs: vitamin_first_node (192.168.10.10), vitamin_second_node (192.168.10.11), server with RabbitMQ (192.168.10.12) and load balancer server (192.168.10.13).
For the sace of simplicity we will use HAProxy for load balancing. Example configuration can be found here
Run RabbitMQ(192.168.10.12):
/etc/init.d/rabbitmq-server startRun first server (192.168.10.10):
./vitamin --rabbitmq_host=192.168.0.12 --rabbitmq_port=5672 --rabbitmq_user=guest --rabbitmq_password=guest --rabbitmq_exchange=vitaminRun second server (192.168.10.11):
./vitamin --rabbitmq_host=192.168.0.12 --rabbitmq_port=5672 --rabbitmq_user=guest --rabbitmq_password=guest --rabbitmq_exchange=vitaminRun Nth server (192.168.10.N):
./vitamin --rabbitmq_host=192.168.0.N --rabbitmq_port=5672 --rabbitmq_user=guest --rabbitmq_password=guest --rabbitmq_exchange=vitaminDo not forget to replace 192.168.10.N to real ip of your Nth server.
Run load-balancer (192.168.10.13):
/etc/init.d/haproxy startFor now all request to load-balancer (192.168.10.13:8080) will be evenly distributed across cache servers. You don't need to think about replication it comes with Vitamin out of the box.
./vitamin --help