From 1e816edf957e6f501474fb418e46d8c952e87498 Mon Sep 17 00:00:00 2001 From: Anthony Date: Sat, 28 Feb 2026 18:50:06 +0800 Subject: [PATCH] fix: reduce dnf memory footprint for Redis install - clean cache, drop caches, disable weak deps --- scripts/install_redis.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) 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