Redis Memory Keeps Increasing in Discourse 3.4.0.beta3

As a temporary fix, I created a small bash script to clean up Redis memory and set it to run every day at 6 AM using a cron job.
Note: I’m saving the log in /home/ubuntu/logs. You can ignore it if you don’t need it.

#!/bin/bash

# Set log directory and filename
LOG_DIR="/home/ubuntu/logs"
LOG_FILE="$LOG_DIR/redis.cleanup.$(date +\%Y-\%m-\%d).log"

# Ensure the log directory exists
mkdir -p "$LOG_DIR"

# Log information about the current environment (host side)
echo "Running script at $(date)" >> "$LOG_FILE"

# Run the discourse launcher in the app and save output to the log file (host side)
echo "redis cleanup command" >> "$LOG_FILE"
docker exec app redis-cli flushall >> "$LOG_FILE" 2>&1

# Indicate that the script is done (host side) and exit
echo "Script completed successfully at $(date)" >> "$LOG_FILE"
exit 0
2 Likes