在 CentOS 上查看 Redis 配置 通常有几种常见方式,下面按使用场景给你说明:
redis-cli
进入后执行:
CONFIG GET *
查看某一项,例如:
CONFIG GET maxmemory
CONFIG GET requirepass
CONFIG GET bind
✅ 这种方式看到的是 Redis 实际生效的配置
redis-cli CONFIG GET dir
或
ps -ef | grep redis
常见路径:
/etc/redis.conf
/etc/redis/redis.conf
cat /etc/redis.conf
或
vim /etc/redis.conf
常见配置项:
bind 127.0.0.1
port 6379
requirepass yourpassword
maxmemory 2gb
appendonly yes
systemctl status redis
或
systemctl status redis.service
查看配置文件位置:
systemctl cat redis
redis-server --version
或
redis-cli INFO server
redis-cli INFO
分类查看:
redis-cli INFO memory
redis-cli INFO persistence
redis-cli INFO replication
CONFIG GET bind
CONFIG GET protected-mode
检查:
bindrequirepassfirewall-cmd --list-all
如果你愿意,可以告诉我:
我可以给你更精确的命令。