简体   繁体   English

Redis忽略redis.conf中的目录

[英]Redis Ignoring directory in redis.conf

I recently installed Redis on OS X. I did an initial load of some objects, everything in this regard seems to be working perfectly. 我最近在OS X上安装了Redis。我最初加载了一些对象,这方面的一切似乎都运行良好。

I saved the data to dump.rdb and if I launch redis from this directory and don't use a redis.conf file everything goes according to plan. 我将数据保存到dump.rdb ,如果我从该目录启动redis,并且不使用redis.conf文件,一切都会按计划进行。

The problem is that after settling in and setting up a redis.conf file in /etc/redis/ it seems to completely ignore the dbfilename and dir settings. 问题在于,在/etc/redis/建立并设置redis.conf文件后,它似乎完全忽略了dbfilenamedir设置。

To be more clear. 更加清楚。 I created a data directory in: /Library/Redis_Data/ . 我在/Library/Redis_Data/创建了一个数据目录。 In the redis.conf I set dbfilename dump.rdb and dir /Library/Redis_Data redis.conf我设置dbfilename dump.rdbdir /Library/Redis_Data

If I launch: redis-server /etc/redis/redis.conf it simply refuses to load the dump.rdb . 如果我启动: redis-server /etc/redis/redis.conf它只是拒绝加载dump.rdb

I've run redis-cli and can read the config parameters get config dbfilename and get config dir and they return the correct values, but no data gets restored. 我已经运行过redis-cli ,可以读取配置参数get config dbfilenameget config dir ,它们返回正确的值,但是没有数据得到恢复。

I also enabled AOF. 我还启用了AOF。 The file appendonly.aof which resides in the same directory will be recreated if I delete it and start the server again. 如果删除它并重新启动服务器,将重新创建驻留在同一目录中的文件appendonly.aof

Lastly...if I run save from the cli it will completely wipe out and create a new dump.rdb over my data. 最后...如果我从cli运行save ,它将完全清除并在我的数据上创建一个新的dump.rdb

Any thoughts? 有什么想法吗?

FYI: redis server v=2.6.9 sha=00000000:0 malloc=libc bits=64 仅供参考:redis服务器v = 2.6.9 sha = 00000000:0 malloc = libc位= 64

Thanks. 谢谢。

Solved: Looking back this morning on this issue I managed to discover the problem. 解决:今天早上回顾这个问题,我设法发现了问题。

I originally added my data without enabling appendonly mode. 我最初添加数据时未启用appendonly模式。 After this test load I setup my environment and decided it would be great to enable appendonly . 完成此测试负载后,我设置了环境,并决定启用appendonly会很棒。

What I discovered is this. 我发现的是这个。 If you have data in the dump.rdb but the appendonly.aof file is empty and appendonly is turned on; 如果dump.rdb有数据,但是appendonly.aof文件为空, 并且 appendonly已打开; Redis will ignore the dump.rdb instead assuming there is nothing to be done because the appendonly.aof transactions don't exist. Redis将忽略dump.rdb而是假设没有任何事情appendonly.aof因为appendonly.aof事务不存在。

What I did: Turned off appendonly in the config file and restarted Redis with the normal directory setup. 我的工作:关闭配置文件中的appendonly ,并使用常规目录设置重新启动Redis。 This then loaded the dump.rdb as per my config file. 然后按照我的配置文件加载dump.rdb I then ran the command from redis-cli config set appendonly yes followed by save . 然后,我从redis-cli config set appendonly yes运行了命令,然后执行save

This then created the appendonly.aof file with all the transactions. 然后,这将创建包含所有事务的appendonly.aof文件。 Set appendonly back to yes in the config and all was right. 在配置appendonly设置回yes ,一切正确。

Cheers, damnabit 干杯,该死的

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM