centos7 systemctl 启动 Redis 失败
2016-08-08 18:25
911 查看
转自:
今天启动 Redis 时阻塞很长时间,之后显示启动失败,启动状态如下。
看了下 service 文件,发现 Systemd 启动命令如下
手动运行这条命令,发现是正常的,所以猜想是 service 文件的问题,后来发现只需要把 [Service] 部分的
之后重新加载 Service 文件并启动 Redis 服务
Man pages 对 Systemd 服务启动类型 Type 的解释如下
因为 Redis 配置文件里配置的是
http://sloger.info/posts/systemd-failed-to-start-redis-in-gentoo
今天启动 Redis 时阻塞很长时间,之后显示启动失败,启动状态如下。
systemd[1]: redis.service start operation timed out. Terminating. systemd[1]: Failed to start A persistent key-value database. systemd[1]: Unit redis.service entered failed state.
看了下 service 文件,发现 Systemd 启动命令如下
ExecStart=/usr/sbin/redis-server /etc/redis.conf
手动运行这条命令,发现是正常的,所以猜想是 service 文件的问题,后来发现只需要把 [Service] 部分的
Type=forking注释掉就行了。
[Service] # Type=forking # PIDFile=/var/run/redis/redis.pid ExecStart=/usr/sbin/redis-server /etc/redis.conf User=redis Group=redis
之后重新加载 Service 文件并启动 Redis 服务
sudo systemctl daemon-reload
sudo systemctl start redis
Man pages 对 Systemd 服务启动类型 Type 的解释如下
If set to forking, it is expected that the process configured with ExecStart= will call fork() as part of its start-up. The parent process is expected to exit when start-up is complete and all communication channels are set up. The child continues to run as the main daemon process. This is the behavior of traditional UNIX daemons. If this setting is used, it is recommended to also use the PIDFile= option, so that systemd can identify the main process of the daemon. systemd will proceed with starting follow-up units as soon as the parent process exits.
因为 Redis 配置文件里配置的是
daemonize off
相关文章推荐
- CentOS 7 上systemctl 的用法(注意不是多个容器服务开机启动)
- Centos 7 - vmware nat、systemctl、设置默认启动方式、SELinux、ssh-copy-id
- centos 使用 systemctl 使 docker 容器(container)开机启动
- CentOS 7中Nginx1.9.5编译安装教程systemctl启动
- CentOS 7中Nginx1.9.5编译安装教程systemctl启动
- docker下centos7 systemctl启动报错 docker Failed to get D-Bus connection 报错
- CentOS7 systemctl 自定义程序启动服务
- Centos7.3_x86_64通过systemctl控制tomcat8.0.46启动和停止
- systemctl配置redis以服务模式启动
- docker centos 无法用systemctl 启动服务的问题
- CentOS 7中Nginx1.9.5编译安装教程systemctl启动
- Docker 启动失败Starting docker (via systemctl): Job for docker.service failed
- 关于运行mysql_install_db命令导致sudo systemctl start /restart mariadb.service启动失败问题
- centos中设置redis开机启动
- CentOS设置开启自动启动Redis的方法
- Centos 6.3 修改xorg.conf后 启动失败
- linux 启动失败--Stopping System V runlevel compatibility-
- CentOS启动时报错:Anerroroccurredduringthefilesystem check
- redis第二篇:Centos下配置Redis开机启动
- CentOS 7 上systemctl 的用法