【发布时间】:2016-01-19 14:20:30
【问题描述】:
启动redis-server:
redis-server /usr/local/etc/redis.conf
Redis 配置文件(/usr/local/etc/redis.conf):
...
requirepass 'foobared'
...
Rails - application.yml:
...
development:
redis_password: 'foobared
...
错误:
Redis::CommandError - NOAUTH Authentication required.:
...
app/models/user.rb:54:in `last_accessed_at'
...
app/models/user.rb:54:
Line 53 - def last_accessed_at
Line 54 - Rails.cache.read(session_key)
Line 55 - end
而session_key只是User模型的一个属性。
顺便说一句:
± ps -ef | grep redis
501 62491 57789 0 1:45PM ttys001 0:00.37 redis-server 127.0.0.1:6379
501 62572 59388 0 1:54PM ttys002 0:00.00 grep --color=auto --exclude-dir=.bzr --exclude-dir=CVS --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn redis
【问题讨论】:
-
您是否忘记告诉我们您在哪里设置了类似
Redis.new(:password => "mysecret")的密码,或者您是否在 rails 应用程序的某个地方设置了此密码?
标签: ruby-on-rails-4 redis redis-cache redis-server