-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrestore_falkordb.ps1
More file actions
54 lines (41 loc) · 1.9 KB
/
restore_falkordb.ps1
File metadata and controls
54 lines (41 loc) · 1.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# FalkorDB Restore Script
# Usage: .\restore_falkordb.ps1 -BackupDate "2025-10-26_1430"
param(
[Parameter(Mandatory=$true)]
[string]$BackupDate
)
$BackupRoot = "C:\mind-protocol-backups"
$BackupDir = "$BackupRoot\$BackupDate"
$DumpFile = "$BackupDir\dump.rdb"
Write-Host "[Restore] Starting FalkorDB restore from $BackupDate..." -ForegroundColor Cyan
# Verify backup exists
if (-not (Test-Path $DumpFile)) {
Write-Host "[Restore] ✗ Error: Backup not found at $DumpFile" -ForegroundColor Red
Write-Host "[Restore] Available backups:" -ForegroundColor Yellow
Get-ChildItem $BackupRoot -Directory | Select-Object Name
exit 1
}
$SizeMB = [math]::Round((Get-Item $DumpFile).Length / 1MB, 2)
Write-Host "[Restore] Found backup: $SizeMB MB" -ForegroundColor Green
# Confirm
Write-Host "[Restore] WARNING: This will replace current FalkorDB data!" -ForegroundColor Red
Write-Host "[Restore] Press Ctrl+C to abort, or Enter to continue..." -ForegroundColor Yellow
Read-Host
# Stop FalkorDB container
Write-Host "[Restore] Stopping FalkorDB container..." -ForegroundColor Yellow
wsl sudo docker stop mind_protocol_falkordb
# Copy backup into container
Write-Host "[Restore] Copying backup file..." -ForegroundColor Yellow
wsl sudo docker cp /mnt/c/mind-protocol-backups/$BackupDate/dump.rdb mind_protocol_falkordb:/var/lib/falkordb/data/dump.rdb
# Fix permissions
Write-Host "[Restore] Fixing permissions..." -ForegroundColor Yellow
wsl sudo docker exec mind_protocol_falkordb chown redis:redis /var/lib/falkordb/data/dump.rdb
# Restart container
Write-Host "[Restore] Restarting FalkorDB..." -ForegroundColor Yellow
wsl sudo docker start mind_protocol_falkordb
# Wait for startup
Start-Sleep -Seconds 5
# Verify
Write-Host "[Restore] Verifying graphs..." -ForegroundColor Yellow
wsl sudo docker exec -it mind_protocol_falkordb redis-cli GRAPH.LIST
Write-Host "[Restore] ✓ Restore complete!" -ForegroundColor Green