demo_vacuum_testing.sh 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. #!/bin/sh
  2. echo "🧪 SeaweedFS Vacuum Task Testing Demo"
  3. echo "======================================"
  4. echo ""
  5. # Check if SeaweedFS is running
  6. echo "📋 Checking SeaweedFS status..."
  7. MASTER_URL="${MASTER_HOST:-master:9333}"
  8. ADMIN_URL="${ADMIN_HOST:-admin:23646}"
  9. if ! curl -s http://$MASTER_URL/cluster/status > /dev/null; then
  10. echo "❌ SeaweedFS master not running at $MASTER_URL"
  11. echo " Please ensure Docker cluster is running: make start"
  12. exit 1
  13. fi
  14. if ! curl -s http://volume1:8080/status > /dev/null; then
  15. echo "❌ SeaweedFS volume servers not running"
  16. echo " Please ensure Docker cluster is running: make start"
  17. exit 1
  18. fi
  19. if ! curl -s http://$ADMIN_URL/ > /dev/null; then
  20. echo "❌ SeaweedFS admin server not running at $ADMIN_URL"
  21. echo " Please ensure Docker cluster is running: make start"
  22. exit 1
  23. fi
  24. echo "✅ All SeaweedFS components are running"
  25. echo ""
  26. # Phase 1: Create test data
  27. echo "📁 Phase 1: Creating test data with garbage..."
  28. go run create_vacuum_test_data.go -master=$MASTER_URL -files=15 -delete=0.5 -size=150
  29. echo ""
  30. # Phase 2: Check initial status
  31. echo "📊 Phase 2: Checking initial volume status..."
  32. go run create_vacuum_test_data.go -master=$MASTER_URL -files=0
  33. echo ""
  34. # Phase 3: Configure vacuum
  35. echo "⚙️ Phase 3: Vacuum configuration instructions..."
  36. echo " 1. Visit: http://localhost:23646/maintenance/config/vacuum"
  37. echo " 2. Set these values for testing:"
  38. echo " - Enable Vacuum Tasks: ✅ Checked"
  39. echo " - Garbage Threshold: 0.30"
  40. echo " - Scan Interval: [30] [Seconds]"
  41. echo " - Min Volume Age: [0] [Minutes]"
  42. echo " - Max Concurrent: 2"
  43. echo " 3. Click 'Save Configuration'"
  44. echo ""
  45. read -p " Press ENTER after configuring vacuum settings..."
  46. echo ""
  47. # Phase 4: Monitor tasks
  48. echo "🎯 Phase 4: Monitoring vacuum tasks..."
  49. echo " Visit: http://localhost:23646/maintenance"
  50. echo " You should see vacuum tasks appear within 30 seconds"
  51. echo ""
  52. echo " Waiting 60 seconds for vacuum detection and execution..."
  53. for i in {60..1}; do
  54. printf "\r Countdown: %02d seconds" $i
  55. sleep 1
  56. done
  57. echo ""
  58. echo ""
  59. # Phase 5: Check results
  60. echo "📈 Phase 5: Checking results after vacuum..."
  61. go run create_vacuum_test_data.go -master=$MASTER_URL -files=0
  62. echo ""
  63. # Phase 6: Create more garbage for continuous testing
  64. echo "🔄 Phase 6: Creating additional garbage for continuous testing..."
  65. echo " Running 3 rounds of garbage creation..."
  66. for round in {1..3}; do
  67. echo " Round $round: Creating garbage..."
  68. go run create_vacuum_test_data.go -master=$MASTER_URL -files=8 -delete=0.6 -size=100
  69. echo " Waiting 30 seconds before next round..."
  70. sleep 30
  71. done
  72. echo ""
  73. echo "📊 Final volume status:"
  74. go run create_vacuum_test_data.go -master=$MASTER_URL -files=0
  75. echo ""
  76. echo "🎉 Demo Complete!"
  77. echo ""
  78. echo "🔍 Things to check:"
  79. echo " 1. Maintenance Queue: http://localhost:23646/maintenance"
  80. echo " 2. Volume Status: http://localhost:9333/vol/status"
  81. echo " 3. Admin Dashboard: http://localhost:23646"
  82. echo ""
  83. echo "💡 Next Steps:"
  84. echo " - Try different garbage thresholds (0.10, 0.50, 0.80)"
  85. echo " - Adjust scan intervals (10s, 1m, 5m)"
  86. echo " - Monitor logs for vacuum operations"
  87. echo " - Test with multiple volumes"
  88. echo ""