Get your RAM PostgreSQL High Availability cluster up and running in under 10 minutes!
Before you begin, ensure you have the following installed:
- PostgreSQL 17:
brew install postgresql@17 - Go 1.21+:
brew install go - Build Tools:
brew install make gcc - Git:
brew install git
# Clone the repository
git clone https://github.com/pgelephant/ram.git
cd ram
# Build all components
make all
# Install components
make installEnable the PGRaft extension in PostgreSQL:
# Edit postgresql.conf
echo "shared_preload_libraries = 'pgraft'" >> /usr/local/var/postgresql@17/postgresql.conf
# Restart PostgreSQL
brew services restart postgresql@17# Create a 3-node cluster
./ramctrl cluster create --num-nodes=3
# Verify cluster creation
./ramctrl cluster statusExpected output:
✓ Cluster 'ram_cluster' created successfully
✓ 3 nodes configured and started
✓ Primary node: localhost:5432
✓ Replica nodes: localhost:5433, localhost:5434
✓ Raft consensus: Active
✓ Health status: Healthy
# Test failover by stopping the primary
./ramctrl cluster stop --node=primary
# Watch automatic failover
./ramctrl cluster status
# Restart the old primary (it will become a replica)
./ramctrl cluster start --node=primary# Start real-time monitoring
./ramctrl monitor
# View detailed cluster information
./ramctrl cluster info
# Check health metrics
curl http://localhost:8008/api/v1/cluster/health# Connect to primary and create test data
psql -h localhost -p 5432 -U postgres -d postgres-- Create test table
CREATE TABLE test_data (id SERIAL PRIMARY KEY, data TEXT);
-- Insert test data
INSERT INTO test_data (data) VALUES ('test1'), ('test2'), ('test3');
-- Check replication lag
SELECT * FROM pg_stat_replication;# Create a backup
./ramctrl backup create --name=initial_backup
# List backups
./ramctrl backup list
# Test restore (optional)
./ramctrl backup restore --name=initial_backup --target-node=replica1Congratulations! You now have a fully functional PostgreSQL high availability cluster. Here's what you can do next:
- Configuration Guide - Customize your cluster
- API Reference - Use the REST API
- Monitoring Setup - Set up Prometheus and Grafana
- Kubernetes Deployment - Deploy on Kubernetes
- Security Configuration - Enable SSL and authentication
- Backup Strategies - Implement backup policies
- Common Issues - Resolve common problems
- Debugging Guide - Debug cluster issues
| Command | Description |
|---|---|
./ramctrl cluster create --num-nodes=3 |
Create 3-node cluster |
./ramctrl cluster status |
Show cluster status |
./ramctrl cluster stop --node=primary |
Stop primary node |
./ramctrl cluster start --node=primary |
Start primary node |
./ramctrl monitor |
Real-time monitoring |
./ramctrl backup create |
Create backup |
./ramctrl backup list |
List backups |
- Documentation: Browse the full documentation
- Issues: Report bugs on GitHub
- Community: Join our discussions
- Support: Contact our support team
Ready for production? Check out our Production Deployment Guide!