我在当地尝试redis, 使用
启动了redis服务器"redis-server"
01 Feb 06:22:50 * Warning: no config file specified, using the default config. In order to specify a config file use 'redis-server /path/to/redis.conf'
01 Feb 06:22:50 - Server started, Redis version 1.000
01 Feb 06:22:50 - The server is now ready to accept connections on port 6379
01 Feb 06:22:51 . 0 clients connected (0 slaves), 5168 bytes in use, 0 shared objects
01 Feb 06:22:54 . Accepted 127.0.0.1:54766
01 Feb 06:22:56 . 1 clients connected (0 slaves), 5888 bytes in use, 0 shared objects
..........
但是当我尝试从rails c console访问redis时,我一直看到" Redis :: CommandError:ERR未知命令",我不知道出了什么问题。 这是版本兼容的问题吗?
irb(main):009:0> redis = Redis.new(host: 'localhost', port: 6379)
irb(main):008:0* redis.get "1"
Redis::CommandError: ERR unknown command
from /Users/xx/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/redis-3.2.0/lib/redis/client.rb:110:in `call'
from /Users/xx/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/redis-3.2.0/lib/redis.rb:784:in `block in get'
from /Users/xx/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/redis-3.2.0/lib/redis.rb:37:in `block in synchronize'
from /Users/xx/.rbenv/versions/2.1.2/lib/ruby/2.1.0/monitor.rb:211:in `mon_synchronize'
from /Users/xx/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/redis-3.2.0/lib/redis.rb:37:in `synchronize'
from /Users/xx/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/redis-3.2.0/lib/redis.rb:783:in `get'
from (irb):8
from /Users/xx/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/railties-4.1.0/lib/rails/commands/console.rb:90:in `start'
from /Users/xx/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/railties-4.1.0/lib/rails/commands/console.rb:9:in `start'
from /Users/xx/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/railties-4.1.0/lib/rails/commands/commands_tasks.rb:69:in `console'
from /Users/xx/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/railties-4.1.0/lib/rails/commands/commands_tasks.rb:40:in `run_command!'
from /Users/xx/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/railties-4.1.0/lib/rails/commands.rb:17:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'