2013-04-08 146 views
3

我正在开发一个已经安装了redis的mac。默认情况下它不具有redis.conf这样的默认设置是,当我$ redis-serverRedis的“操作不允许”

# Warning: no config file specified, using the default config. In order to specify a config file use 'redis-server /path/to/redis.conf' 

我想使用redis-py使用并具有下列

import redis 
r = redis.Redis('localhost') 
r.set('foo','bar') 
r.get('foo') 

而且得到了以下错误

redis.exceptions.ResponseError: operation not permitted 

我也尝试在终端$ redis-cli ping,但后来我得到以下错误

(error) ERR operation not permitted 

我想因为没有redis.conf默认设置没有密码对不对?不管怎么说,我也试图创建一个redis.conf

$ echo "requirepass foobared" >> redis.conf 
$ redis-server redis.conf 

然后在另一个窗口

$ redis-cli 
$ redis 127.0.0.1:6379> AUTH foobared 
(error) ERR invalid password 

还修改了python脚本的第二行

r = redis.StrictRedis(host='localhost', port=6379, db=0, password='foobared') 

,但后来我

redis.exceptions.ResponseError: invalid password 

我能做什么错?谢谢

+0

你试过路过'密码='? – 2013-04-08 15:21:59

+0

@JonClements:是的,对不起,这是一个错字。在问题中修复。有什么建议么? thx – minovsky 2013-04-08 15:28:27

+0

发布你的redis配置 – 2013-04-16 22:02:49

回答

0

没有任何redis.conf文件,Redis使用默认的内置配置。所以默认的数据库文件(dump.rdb)和追加文件是在服务器目录中创建的。也许运行Redis的用户对此目录没有写入权限。

所以要么给他的权限,要么使用配置文件定义另一个工作目录。

你会发现Redis的2.6 here 您必须修改此行的文件在默认的配置文件:

# The working directory. 
dir ./