Running the Cluster
July 15, 2025Running the Cluster
Learn how to set up and run a multi-node Shreder cluster.
Single Node Setup
Start a single cache node:
./bin/shreder --port :8060
Multi-Node Cluster Setup
Start a 4-node cluster:
# Terminal 1 - Node 1./bin/shreder --port :8060 --peers localhost:8061,localhost:8062,localhost:8063
# Terminal 2 - Node 2./bin/shreder --port :8061 --peers localhost:8060,localhost:8062,localhost:8063
# Terminal 3 - Node 3./bin/shreder --port :8062 --peers localhost:8060,localhost:8061,localhost:8063
# Terminal 4 - Node 4./bin/shreder --port :8063 --peers localhost:8060,localhost:8061,localhost:8062
API Usage Examples
Setting Values
Store a key-value pair:
curl -X POST http://localhost:8060/set \ -H "Content-Type: application/json" \ -d '{"key": "user:123", "value": "john_doe"}'
Getting Values
Retrieve a value by key:
curl "http://localhost:8060/get?key=user:123"
Testing the System
Test data distribution and replication:
# Set data on different nodescurl -X POST http://localhost:8060/set -H "Content-Type: application/json" -d '{"key": "test1", "value": "hello"}'curl -X POST http://localhost:8061/set -H "Content-Type: application/json" -d '{"key": "test2", "value": "world"}'
# Verify data is accessible from any nodecurl "http://localhost:8062/get?key=test1" # Should return "hello"curl "http://localhost:8063/get?key=test2" # Should return "world"