Eden-MDBS provides a powerful migration system for safely moving traffic and data between endpoints. This enables zero-downtime database migrations, A/B testing, and gradual rollouts.
Migrations in Eden-MDBS orchestrate the transition from one endpoint to another. The system supports:
Migrations can be applied to two types of resources:
Immediate cutover to the new endpoint. All traffic switches at once.
{
"strategy": {
"type": "big_bang"
}
}Best for: Simple migrations, acceptable brief downtime, low-risk changes.
Route a percentage of traffic to test the new system gradually.
{
"strategy": {
"type": "canary",
"read_percentage": 0.05,
"write_mode": {
"mode": "dual_write",
"policy": "old_authoritative"
}
}
}Parameters:
read_percentage: Fraction of reads to route to new system (0.0 to 1.0)write_mode: How writes are handled - dual_write: Write to both systems (safest)
- cutover: Gradually shift writes to new system
Best for: Risk mitigation, performance validation, gradual rollouts.
Maintain two identical environments with instant traffic switching.
{
"strategy": {
"type": "blue_green",
"active_is_new": false
}
}Parameters:
active_is_new: false = blue (old), true = green (new)Best for: Zero-downtime migrations, instant rollback capability.
Replace instances one by one, minimizing blast radius.
{
"strategy": {
"type": "rolling_update",
"migrated_instances": [],
"total_instances": 5
}
}Parameters:
migrated_instances: List of migrated instance IDstotal_instances: Total number of instances to migrateBest for: Sharded databases, distributed systems.
Duplicate requests to new system without affecting responses. Test safely in production.
{
"strategy": {
"type": "shadow_traffic"
}
}Best for: Risk-free testing, validation, finding edge cases.
Migrate feature by feature, gradually replacing the old system.
{
"strategy": {
"type": "strangler_fig",
"features": {
"user_auth": true,
"payments": false,
"reporting": false
}
}
}Parameters:
features: Map of feature names to migration statusBest for: Large monolithic systems, long-term refactoring.
Control migration with feature flags per user segment.
{
"strategy": {
"type": "feature_flag",
"flags": {
"new_database": true,
"beta_features": false
},
"rollout_percentage": 0.25
}
}Parameters:
flags: Map of flag names to enabled statusrollout_percentage: Percentage of users who see enabled flagsBest for: Fine-grained control, rapid rollback.
Migrate one region at a time.
{
"strategy": {
"type": "geographic",
"regions": {
"us-east-1": true,
"eu-west-1": false,
"ap-southeast-1": false
}
}
}Parameters:
regions: Map of region identifiers to migration statusBest for: Global systems, regional compliance, timezone-based rollouts.
Schedule migration during a maintenance window.
{
"strategy": {
"type": "time_window",
"window_start": "2024-01-15T02:00:00Z",
"window_end": "2024-01-15T04:00:00Z",
"executed": false
}
}Parameters:
window_start: ISO 8601 start timewindow_end: ISO 8601 end timeexecuted: Whether migration has completedBest for: Systems with clear low-traffic periods.
Control how historical data is transferred from source to target.
No automatic data transfer. Use when:
{
"data": "none"
}Point-in-time snapshot copied to new database.
{
"data": {
"type": "snapshot",
"replace": "none"
}
}Characteristics:
Continuously scan and replicate data in real-time.
{
"data": {
"type": "scan",
"replace": "replace"
}
}Conflict Rules:
none: Skip conflicting recordsreplace: Overwrite target with source datamerge: Use database-specific merge logicDefine how errors are managed during migration.
Revert everything if any component fails (default).
{
"failure_handling": "rollback_all"
}Retry failed operations before rolling back.
{
"failure_handling": {
"type": "retry_then_all",
"retry_count": 3
}
}Allow some migrations to fail while others succeed.
{
"failure_handling": "allow_partial"
}curl http://{host}:8000/api/v1/migrations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
"id": "migrate_to_new_redis",
"description": "Migrate user cache to new Redis cluster",
"strategy": {
"type": "canary",
"read_percentage": 0.05,
"write_mode": {
"mode": "dual_write",
"policy": "old_authoritative"
}
},
"data": {
"type": "scan",
"replace": "replace"
},
"failure_handling": "rollback_all"
}'Add an API to the migration:
curl http://{host}:8000/api/v1/migrations/migrate_to_new_redis/api/user_cache_api \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
"id": "user_cache_api",
"bindings": [
{
"template": "get_user_template",
"fields": {}
}
]
}'Add an interlay to the migration:
curl http://{host}:8000/api/v1/migrations/migrate_to_new_redis/interlay/user_cache_interlay \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
"endpoint": "new_redis_cluster"
}'Verify the migration configuration:
curl http://{host}:8000/api/v1/migrations/migrate_to_new_redis/test \
-H "Authorization: Bearer $TOKEN" \
-X POSTStart the migration:
curl http://{host}:8000/api/v1/migrations/migrate_to_new_redis/migrate \
-H "Authorization: Bearer $TOKEN" \
-X POSTcurl http://{host}:8000/api/v1/migrations/migrate_to_new_redis \
-H "Authorization: Bearer $TOKEN"Response:
{
"status": "success",
"data": {
"id": "migrate_to_new_redis",
"uuid": "550e8400-e29b-41d4-a716-446655440000",
"description": "Migrate user cache to new Redis cluster",
"status": "running",
"strategy": {
"type": "canary",
"read_percentage": 0.05
},
"apis": [...],
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:35:00Z"
}
}curl http://{host}:8000/api/v1/migrations \
-H "Authorization: Bearer $TOKEN"A typical canary migration proceeds through these stages:
# Create migration with 5% read traffic
curl http://{host}:8000/api/v1/migrations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
"id": "canary_migration",
"strategy": {
"type": "canary",
"read_percentage": 0.05,
"write_mode": {"mode": "dual_write", "policy": "old_authoritative"}
}
}'Update the migration to increase traffic:
curl http://{host}:8000/api/v1/migrations/canary_migration \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-X PATCH \
-d '{
"strategy": {
"type": "canary",
"read_percentage": 0.25,
"write_mode": {"mode": "dual_write", "policy": "old_authoritative"}
}
}'curl http://{host}:8000/api/v1/migrations/canary_migration \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-X PATCH \
-d '{
"strategy": {
"type": "canary",
"read_percentage": 0.75,
"write_mode": {"mode": "dual_write", "policy": "old_authoritative"}
}
}'curl http://{host}:8000/api/v1/migrations/canary_migration \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-X PATCH \
-d '{
"strategy": {
"type": "canary",
"read_percentage": 1.0,
"write_mode": {"mode": "cutover", "write_percentage": 1.0}
}
}'| Operation | Required Access |
|---|---|
| Create migration | Admin |
| Get migration | Admin |
| List migrations | Read |
| Add API/Interlay | Admin |
| Test migration | Admin |
| Execute migration | Admin |