Redis Cluster日志冗余问题求助:日志级别设为warning仍有大量日志
Hey there, let's break down the problem you're hitting with your Redis Cluster. First, let's recap your setup: you've got a Redis Cluster where each machine runs two instances (ports 7000 and 7001), and here's the redis.conf for your 7000-port instance:
bind 127.0.0.1 bind 10.0.0.20 port 7000 cluster-enabled yes cluster-config-file nodes.7000.conf cluster-node-timeout 15000 appendonly yes appendfilename "appendonly.7000.aof" timeout 0 tcp-keepalive 60 databases 1 stop-writes-on-bgsave-error no loglevel warning logfile "serverlog.7000.txt"
Even though you've set loglevel warning, you're still seeing unwanted lower-priority logs (like info or debug) in your log file. Here are the most common fixes for this:
1. Cluster-Specific Log Level Override
The big gotcha here is that Redis Cluster's internal node-to-node communication logs don't respect the general loglevel setting by default. These logs (marked with a [cluster] prefix) are set to info out of the box, so they'll show up even if your main log level is warning.
To fix this, add a dedicated cluster log level setting to your redis.conf:
cluster-log-level warning
This will suppress all non-critical cluster communication logs, aligning them with your desired warning-only policy.
2. Verify Configuration is Actually Loaded
It's easy to make a mistake here—maybe you edited the config file but didn't restart the Redis instance, or you pointed the server to the wrong config path on startup.
Check the active settings for your 7000 instance with these commands:
redis-cli -p 7000 CONFIG GET loglevel redis-cli -p 7000 CONFIG GET cluster-log-level
If either returns something other than warning, your config isn't taking effect. Restart the instance with the correct config file path to apply the changes:
redis-server /path/to/your/redis.conf
3. BGSAVE-Related Informational Logs
Even with stop-writes-on-bgsave-error no set, Redis might log info-level messages about background save operations (like fork success/metrics). These are normal operational messages, but if you want to suppress them, double-check that your loglevel is properly applied (using the command above) and that no other runtime config changes are overriding it.
内容的提问来源于stack exchange,提问作者Mike Christensen

