我安装了redis并将redis-server放在/usr/local/bin:
-rwxr-xr-x 1 redis redis 11044232 Sep 24 00:30 redis-server我在同一个文件夹/usr/ redis.conf /bin中有本地:
-rwxr-xr-x 1 redis redis 120 Oct 6 21:30 redis.conf我在/etc/systemd/ redis.service中创建了系统:
-rw-r--r-- 1 root root 192 Oct 6 21:46 redis.servicecat redis.conf:
Description=Redis
After=network.target
[Service]
User=redis
Group=redis
Type=Simple
ExecStart=/usr/local/bin/redis-server /usr/local/bin/redis.conf
[Install]
WantedBy=multi-user.target但是当我跑的时候
sudo systemctl restart redis
sudo systemctl status redis显示:无法打开仅附加文件:权限被拒绝
如果我在redis.service中将服务单元中的用户和组更改为“根”,然后再次重新启动,那么redis服务器就会成功启动。
我添加了用户redis:
sudo useradd --no-create-home --shell /bin/false redis原因何在?我想使用专用用户redis来启动服务器。
发布于 2020-11-08 04:43:27
导致
用户redis没有访问/usr/local/bin/appendonly.aof的用户权限,因为它位于/usr/local/bin中。
默认情况下,Redis工作目录是相对于redis.conf的,由以下行设置:
dir ./解决方案
redis.conf中的dir ./更改为redis用户redis.conf放在redis用户可写的目录中(无论如何只有可执行文件应位于<代码>D18中)https://stackoverflow.com/questions/64722162
复制相似问题