我在我的虚拟机上安装了Redis,已经有一段时间没有使用它了。(我最后一次使用它是可以工作的,现在却无法正常工作。这段时间内什么都没有改变(大约一个月))。不用说,我感到很困惑,但我会尽可能提供更多信息。
输入
我相信这可能是一些愚蠢的事情,可能是某个地方的权限问题(我已经尝试以root身份执行此操作,仅供参考),但仍然无效。有没有人在Redis上遇到过类似的问题?
输入
$ redis-server
来启动服务器,但会提示关于overcommit memory设置为0的警告。由于我在虚拟机上,所以我不能将这个设置从0更改为1(即使我想,也不会因为我不需要),但我已经编写了一个自定义redis.config文件,并希望Redis使用它(而且我过去一直在使用它)。因此,使用默认配置文件启动Redis对我不起作用。让我们再试一次。$ redis-server redis.config
$
没有任何信息。静默无声。没有错误提示,就是没有启动。
$ nohup redis-server redis.config > nohup.out&
我得到了进程 ID,但是在运行$ ps
命令时,我看到进程被列为stop
,并且很快消失了。同样,没有错误输出,在redis的日志文件和nohup.out中也没有任何输出。下面是我使用的redis.config(为了简洁起见,去掉了注释)。
daemonize yes
pidfile [my-user-account-path]/redis/redis.pid
port 0
bind 127.0.0.1
unixsocket [my-user-account-path]/tmp/redis.sock
unixsocketperm 770
timeout 10
tcp-keepalive 60
loglevel warning
logfile [my-user-account-path]/redis/logs/redis.log
databases 16
save 900 1
save 300 10
save 60 10000
stop-writes-on-bgsave-error no
rdbcompression no
rdbchecksum no
dbfilename dump.rdb
dir [my-user-account-path]/redis/db
slave-serve-stale-data yes
slave-priority 100
appendonly no
lua-time-limit 5000
slowlog-log-slower-than 10000
slowlog-max-len 128
# ADVANCED CONFIG is set to all default settings#
我相信这可能是一些愚蠢的事情,可能是某个地方的权限问题(我已经尝试以root身份执行此操作,仅供参考),但仍然无效。有没有人在Redis上遇到过类似的问题?
[23272] 11 Apr 12:40:55.860 # 无法将文件限制的最大数量设置为10032(操作不允许),将最大客户端配置设置为3984。 [23272] 11 Apr 12:40:55.861 # 服务器已启动,Redis版本2.6.10 [23272] 11 Apr 12:40:55.861 # 警告:overcommit_memory设置为0!在低内存条件下,后台保存可能会失败。要解决此问题,请在/etc/sysctl.conf中添加“vm.overcommit_memory=1”,然后重新启动或运行命令“sysctl vm.overcommit_memory=1”以使其生效。
- runspiredCTRL+F
查找*Background saving is failing with a fork() error under Linux even if I've a lot of free RAM!*)指出,如果overcommit
设置为0,则可能会遇到一些问题。 - adrianp