Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linux yum 安装 Redis 踩坑 #10

Open
zhangwt-cn opened this issue Sep 5, 2023 · 0 comments
Open

Linux yum 安装 Redis 踩坑 #10

zhangwt-cn opened this issue Sep 5, 2023 · 0 comments
Labels
Linux os Redis 数据库

Comments

@zhangwt-cn
Copy link
Owner

zhangwt-cn commented Sep 5, 2023

安装命令

yum install -y redis

启动报错

启动命令service redis start,以下是具体报错信息

[root@master01 etc]# systemctl status redis.service
● redis.service - Redis persistent key-value database
   Loaded: loaded (/usr/lib/systemd/system/redis.service; disabled; vendor pres>
   Active: failed (Result: exit-code) since Mon 2023-09-04 11:39:56 CST; 6min a>
  Process: 51746 ExecStart=/usr/bin/redis-server /etc/redis.conf --supervised s>
 Main PID: 51746 (code=exited, status=217/USER)

9月 04 11:39:56 master01 systemd[1]: Starting Redis persistent key-value databa>
9月 04 11:39:56 master01 systemd[1]: redis.service: Main process exited, code=e>
9月 04 11:39:56 master01 systemd[1]: redis.service: Failed with result 'exit-co>
9月 04 11:39:56 master01 systemd[1]: Failed to start Redis persistent key-value>

分析以后发现是没有权限导致的,以下是解决方案

mkdir /var/lib/redis;
mkdir /var/log/redis;
groupadd redis;
useradd -M redis -g redis -s /sbin/nologin;
chown -R redis:redis /var/lib/redis;
chown -R redis:redis /var/log/redis;
chmod 644 /etc/redis.conf;

依次执行之后再使用service redis start 就能成功启动

@zhangwt-cn zhangwt-cn added Linux os Redis 数据库 labels Sep 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Linux os Redis 数据库
Projects
None yet
Development

No branches or pull requests

1 participant