在 CentOS 上查看 Redis 配置,常见有 命令行查看 和 配置文件查看 两种方式。
redis-cli CONFIG GET *
redis-cli CONFIG GET port
redis-cli CONFIG GET dir
redis-cli CONFIG GET maxmemory
redis-cli CONFIG GET save
redis-cli INFO
redis-cli INFO server
redis-cli INFO memory
redis-cli INFO persistence
redis-cli CONFIG GET dir
或
ps -ef | grep redis
常见路径:
/etc/redis.conf
/etc/redis/redis.conf
cat /etc/redis.conf
或
grep -v '^#' /etc/redis.conf | grep -v '^$'
(去掉注释和空行,更清晰)
redis-cli CONFIG REWRITE
注意:该命令会把当前运行配置写回配置文件(慎用)
systemctl status redis
systemctl status redis-server
如果你愿意,可以告诉我:
我可以给你更精确的命令。