diff --git a/scripts/install_redis.sh b/scripts/install_redis.sh index ba8103c..a8784ea 100644 --- a/scripts/install_redis.sh +++ b/scripts/install_redis.sh @@ -131,8 +131,14 @@ step_install() { lock_retries=$((lock_retries - 1)) done - if ! dnf install -y redis 2>&1; then - error_exit "dnf install redis failed. Check: (1) internet connectivity, (2) dnf repo config, (3) run: dnf install -y redis" + # Free memory: clean dnf cache and drop OS caches before install + dnf clean all >/dev/null 2>&1 || true + sync; echo 3 > /proc/sys/vm/drop_caches 2>/dev/null || true + + if ! dnf install -y --setopt=install_weak_deps=False --setopt=keepcache=False redis 2>&1; then + local mem_avail + mem_avail=$(awk '/MemAvailable/{print int($2/1024)"MB"}' /proc/meminfo 2>/dev/null || echo "unknown") + error_exit "dnf install redis failed (available RAM: $mem_avail). If OOM, scale up the node first. Then run: dnf install -y redis" fi # Verify binary appeared post-install