Redis 错误:Failed with result 'start-limit-hit'
Redis 错误:Failed with result 'start-limit-hit'
背景
Redis 版本为 5.0.4;
文件 /etc/systemd/system/redis.service 内容如下:
[Unit]
Description=Redis Datastore Server
After=network.target
[Service]
Type=forking
PIDFile=/var/run/redis/redis_6379
User=redis
Group=redis
Environment=statedir=/var/run/redis
PermissionsStartOnly=true
ExecStartPre=/bin/mkdir -p ${statedir}
ExecStartPre=/bin/chown -R redis:redis ${statedir}
ExecStart=/usr/local/bin/redis-server /etc/redis/redis.conf --supervised systemd
ExecReload=/bin/kill -USR2 $MAINPID
ExecStop=/usr/local/bin/redis-cli shutdown
Restart=always
[Install]
WantedBy=multi-user.target
运行
在使用 systemctl 启动 Redis 时报错:
sudo systemctl daemon-reload
sudo systemctl start redis
错误日志:
Job for redis-server.service failed because the control process exited with error code. See "systemctl status redis-server.service" and "journalctl -xe" for details.
根据提示用命令 systemctl status redis-server.service 查看结果如下:
● redis-server.service - Redis Datastore Server
Loaded: loaded (/lib/systemd/system/redis-server.service; enabled; vendor preset: enabled)
Active: failed (Result: start-limit-hit) since Thu 2019-04-18 15:36:10 CST; 5s ago
Process: 8341 ExecStart=/usr/bin/redis-server /etc/redis/redis.conf --supervised systemd (code=exited
Process: 8337 ExecStartPre=/bin/chown -R redis:redis ${statedir} (code=exited, status=0/SUCCESS)
Process: 8333 ExecStartPre=/bin/mkdir -p ${statedir} (code=exited, status=0/SUCCESS)
Apr 18 15:36:10 dl26 systemd[1]: Failed to start Redis Datastore Server.
Apr 18 15:36:10 dl26 systemd[1]: redis-server.service: Unit entered failed state.
Apr 18 15:36:10 dl26 systemd[1]: redis-server.service: Failed with result 'exit-code'.
Apr 18 15:36:10 dl26 systemd[1]: redis-server.service: Service hold-off time over, scheduling restart.
Apr 18 15:36:10 dl26 systemd[1]: Stopped Redis Datastore Server.
Apr 18 15:36:10 dl26 systemd[1]: redis-server.service: Start request repeated too quickly.
Apr 18 15:36:10 dl26 systemd[1]: Failed to start Redis Datastore Server.
Apr 18 15:36:10 dl26 systemd[1]: redis-server.service: Unit entered failed state.
Apr 18 15:36:10 dl26 systemd[1]: redis-server.service: Failed with result 'start-limit-hit'.
发现 ExecStart=/usr/bin/redis-server /etc/redis/redis.conf --supervised systemd 报错,执行该命令出现如下错误日志:
*** FATAL CONFIG FILE ERROR ***
Reading the configuration file, at line 88
>>> 'protected-mode yes'
Bad directive or wrong number of arguments
问题是在处理配置文件时出现参数不匹配现象,原因是因为我在用源码安装 redis 后还用 apt-get install redis 的方法安装了一个旧版本的 redis,在 /usr/bin/ 目录下的 redis-server 不是最新版本,故出现不兼容的问题。
解决方法:
cp -r redis/src/redis-server /usr/bin/redis-server
再次执行:
sudo systemctl daemon-reload
sudo systemctl start redis
仍然报同样的错误,执行/usr/bin/redis-server /etc/redis/redis.conf --supervised systemd,日志如下:
8436:C 18 Apr 2019 15:37:50.558 # Can't chdir to '/home/chenxiang/redis': No such file or directory
发现是目录名称不存在,文件 /etc/redis/redis.conf 中的目录名称为 /home/chenxiang/redis,而实际 redis 目录名称为 /home/chenxiang/redis-5.0.4,修改实际目录名称为 redis 即解决这一问题。
继续运行:
sudo systemctl daemon-reload
sudo systemctl start redis
出现了新的错误:
Job for redis-server.service failed because a timeout was exceeded. See "systemctl status redis-server.service" and "journalctl -xe" for details.
通过 systemctl status redis-server.service 查看日志信息:
● redis-server.service - Redis Datastore Server
Loaded: loaded (/lib/systemd/system/redis-server.service; enabled; vendor preset: enabled)
Active: activating (start) since Thu 2019-04-18 15:49:48 CST; 1min 21s ago
Process: 8533 ExecStart=/usr/bin/redis-server /etc/redis/redis.conf --supervised systemd (code=exited
Process: 8530 ExecStartPre=/bin/chown -R redis:redis ${statedir} (code=exited, status=0/SUCCESS)
Process: 8527 ExecStartPre=/bin/mkdir -p ${statedir} (code=exited, status=0/SUCCESS)
CGroup: /system.slice/redis-server.service
└─8535 /usr/bin/redis-server 127.0.0.1:6379
Apr 18 15:49:48 dl26 systemd[1]: Starting Redis Datastore Server...
Apr 18 15:49:48 dl26 redis-server[8533]: 8533:C 18 Apr 2019 15:49:48.250 # oO0OoO0OoO0Oo Redis is start
Apr 18 15:49:48 dl26 redis-server[8533]: 8533:C 18 Apr 2019 15:49:48.250 # Redis version=5.0.4, bits=64
Apr 18 15:49:48 dl26 redis-server[8533]: 8533:C 18 Apr 2019 15:49:48.250 # Configuration loaded
Apr 18 15:49:48 dl26 redis-server[8533]: 8533:C 18 Apr 2019 15:49:48.250 # systemd supervision requeste
Apr 18 15:49:48 dl26 systemd[1]: redis-server.service: PID file /var/run/redis/redis_6379 not readable
发现 redis-server.service 没有足够的权限访问 /var/run/redis/redis_6379,需要修改/etc/systemd/system/redis.service为:
[Unit]
Description=Redis Datastore Server
After=network.target
[Service]
Type=forking
PIDFile=/var/run/redis/redis.pid
User=redis
Group=redis
Environment=statedir=/var/run/redis
PermissionsStartOnly=true
ExecStartPre=/bin/mkdir -p ${statedir}
ExecStartPre=/bin/chown -R redis:redis ${statedir}
ExecStartPost=/bin/sh -c "echo 6739 > /var/run/redis/redis.pid"
ExecStart=/usr/local/bin/redis-server /etc/redis/redis.conf --supervised systemd
ExecReload=/bin/kill -USR2 $MAINPID
ExecStop=/usr/local/bin/redis-cli shutdown
Restart=always
[Install]
WantedBy=multi-user.target
其中修改两行:PIDFile=/var/run/redis/redis.pid,以及 ExecStartPost=/bin/sh -c "echo 6739 > /var/run/redis/redis.pid"。
2019.4
Redis 错误:Failed with result 'start-limit-hit'的更多相关文章
- Redis 错误1067:进程意外终止,Redis不能启动,Redis启动不了
Redis 错误1067:进程意外终止,Redis不能启动,Redis启动不了 >>>>>>>>>>>>>>> ...
- python pip安装模块提示错误failed to create process
python pip安装模块提示错误failed to create process 原因: 报这个错误的原因,是因为python的目录名称或位置发生改动. 解决办法: 1.找到修改python所在的 ...
- Ubuntu18.04系统执行语句时出现错误Failed to load module "canberra-gtk-module"
Ubuntu18.04系统执行gnuradio-companion时,命令行提示错误Failed to load module "canberra-gtk-module",虽然看起 ...
- golang 操作redis 错误:failed redigo: unexpected type for String, got type int64
报错的代码: isExist,err := redis.String(conn.Do("EXISTS", key)) 这个操作返回的应该是bool类型,所有改成 isExist,e ...
- 错误处理(Operation Result)方法
自己开发的公众号,可以领取淘宝内部优惠券 问题 现在有一个FileStorageService类,继承自IStorageService,具体实现如下 public interface IStorage ...
- IDEA通过Jedis操作Linux上的Redis;Failed to connect to any host resolved for DNS name问题
testPing.java public class testPing { public static void main(String[] args) { Jedis jedis = new Jed ...
- Redis错误配置详解
在使用Redis做缓存时,应用往往能得到非常高的性能.然而,如果配置不当,你将遇到很多令人头疼的问题,比如复制缓冲区限制.复制超时等. Redis提供了许多提高和维护高效内存数据库使用的工具.在无需额 ...
- redis错误总结
1.同步错误.不停重试一直不成功 Full resync from master: e51165e2868c541e28134a287f9bfe36372bae34:80575961684 MASTE ...
- Maven错误Failed to read artifact descriptor for xxx:jar 和 missing artifact maven dependency
可参考:http://stackoverflow.com/questions/6111408/maven2-missing-artifact-but-jars-are-in-place http:// ...
随机推荐
- python之路—博客目录
python基础一 格式化输出&初始编码&运算符 数据类型&字符串得索引及切片 列表 & 元组& join & range 字典dict python2 ...
- 添加新网络模型后运行报错:未定义的参数:ps_roipooling param
现象描述:在新增了具有自定义的data层或者loss层的网路之后,工程运行会报错: 疑惑:并没有这样的参数新增,并且前向的deploy文件已经将自定义的loss以及data等都去掉了: 可能的原因:虽 ...
- 在linux系统中出现u盘问题 的相关解决方法
1.显示unknown filesystem type .exfat 可以通过该方法解决: 安装exfat-fuse: 在终端中以管理员身份运行 sudo apt-get install exfat- ...
- ASA failover --AA
1.A/A Failover 介绍 安全设备可以成对搭配成A/A的FO来提供设备级的冗余和负载分担. 两个设备在互为备份的同时,也能同时转发流量. 使用虚拟子防火墙是必须的,子防火墙被归为两个FO组 ...
- Jmeter学习之--dubbo接口测试
背景:公司的h5和APP都需要调用许多非http的服务,需要对服务的性能和自动化测试 工具:IDEA ,maven,Jmeter 参考文档: https://testerhome.com/topics ...
- 了解JVM运行时的内存分配
了解JVM运行时的内存分配 前言 上文中,在介绍运行时数据区域中的 JAVA 堆时,提到了 JVM 中的堆,一般分为三大部分:新生代.老年代.永久代,本文将进一步了解运行时的内存分配情况. 正文 1. ...
- 异步请求取得json数据
一.异步请求 在之前我们请求数据的时候都是整个页面全部刷新了一次,也就是每次请求都会重新请求所有的资源.但是在很多时候不需要页面全部刷新,仅仅是需要页面的局部数据刷新即可,此时需要发送异步请求来实现这 ...
- mybatis 分页插件
博客地址http://www.jianshu.com/nb/5226994 引言 对于使用Mybatis时,最头痛的就是写分页,需要先写一个查询count的select语句,然后再写一个真正分页查询的 ...
- pandas处理时间序列(3):重采样与频率转换
五.重采样与频率转换 1. resample方法 rng = pd.date_range('1/3/2019',periods=1000,freq='D') rng 2. 降采样 (1)resampl ...
- mysql导入本地文件(作业)
1.准备本地文件(pet.txt) 2.在CMD中启动mysql服务,然后输入以下命令导入(pet.txt) load data local infile '路劲' into table pet; 3 ...