A distributed key-value store implementation with service discovery and load balancing.
NOTE:Currently work in progress. NOT READY FOR PRODUCTION USE!
┌─────────────┐
│ Service │
│ Registry │
└─────────────┘
▲
│
┌─────────────┐
┌─────▶│ Gateway │◀─────┐
│ └─────────────┘ │
▼ ▼
┌─────────────┐ ┌─────────────┐
│ KV Server │ │ KV Server │
│ 1 │ │ 2 │
└─────────────┘ └─────────────┘
There could be n number of KV Servers
- Service Registry: Manages available KV server nodes
- Gateway Server: Routes client requests to appropriate KV servers
- KV Servers: Store and manage key-value pairs persistently
- Python 3.9+
- Docker
- Docker Compose
- Clone the repository:
git clone https://github.com/yourusername/flexstore.git
cd flexstore- Install dependencies:
pip install -r requirements.txtStart all services:
docker-compose up --buildGateway Server (Default port: 8002)
GET /kv/<key>- Retrieve value for keyPUT /kv/<key>- Store value for keyDELETE /kv/<key>- Delete key-value pair
Service Registry (Default port: 8000)
GET /nodes- List all registered nodesPOST /register- Register a new KV server node
- Store a value:
curl -X PUT -d "value123" http://localhost:5000/kv/mykey- Retrieve a value:
curl http://localhost:5000/kv/mykey- Delete a value:
curl -X DELETE http://localhost:5000/kv/mykeyRun individual components:
# Start Service Registry
python service_registry/service_registry.py
# Start Gateway Server
python gateway_server/gateway_server.py
# Start KV Servers
PORT=8001 python kv_server/kv_server.py
PORT=8002 python kv_server/kv_server.py