在 CentOS 上,Redis 的配置文件路径取决于安装方式,常见情况如下:
yum / dnf 安装(最常见)# 配置文件路径
/etc/redis.conf
# 或
/etc/redis/redis.conf
查看是否安装:
rpm -ql redis | grep redis.conf
默认路径通常在:
/usr/local/redis/redis.conf
或你编译时指定的目录,例如:
/opt/redis/redis.conf
容器内默认:
/usr/local/etc/redis/redis.conf
宿主机路径由 -v 挂载决定。
ps -ef | grep redis
示例输出:
redis-server *:6379 /etc/redis.conf
redis-cli
CONFIG GET dir
CONFIG GET save
配置文件:/etc/redis.conf
数据目录:/var/lib/redis
日志文件:/var/log/redis/redis.log
服务文件:/usr/lib/systemd/system/redis.service
如果你是 CentOS 7 / 8 / Stream,或者用的是 宝塔 / 云服务器镜像,可以告诉我,我可以给你更精确的路径。