Debian10 apt安装Redis配置文件位置及修改不生效问题咨询
问题修复步骤
第一步:修复配置文件权限
Debian 10 apt源安装的Redis默认以redis系统用户运行,配置文件需对redis用户开放读取权限,执行以下命令重置权限:sudo chown redis:redis /etc/redis/redis.conf sudo chmod 640 /etc/redis/redis.conf你之前手动执行
redis-server /etc/redis/redis.conf报错打不开,是因为普通用户无该配置文件的读取权限,不要直接手动启动进程,使用系统systemd管理即可。第二步:校验Redis systemd服务配置
执行命令查看Redis服务的启动参数:systemctl cat redis-server | grep ExecStart正常输出应为
ExecStart=/usr/bin/redis-server /etc/redis/redis.conf,如果未携带配置文件路径,需要修改服务配置文件,修改完成后执行sudo systemctl daemon-reload重载配置。第三步:清理残留进程并重启服务
先排查是否有未带配置启动的Redis残留进程占用端口:ps aux | grep redis-server若有非systemd启动的冗余进程,执行
sudo kill -9 对应进程ID杀死进程,之后重启Redis服务:sudo systemctl restart redis-server第四步:验证配置是否生效
进入redis-cli执行以下命令校验:config get bind info server | grep config_file此时bind参数应与配置文件中修改的一致,config_file字段会显示
/etc/redis/redis.conf路径。
内容的提问来源于stack exchange,提问作者Sam Leurs
相关产品推荐
相关产品推荐

