1

环境:

Ubuntu 9.10(在 VirtualBox 中运行)
Ruby v1.8.7
Redis gem v2.0.6

在 irb 上,当我尝试初始化 Redis 时,我得到一个RuntimeError. 这是一个片段:

irb(main):001:0> require 'rubygems'
=> true

irb(main):002:0> require 'redis'
WARNING: using the built-in Timeout class which is known to have issues when used for opening connections. Install the SystemTimer gem if you want to make sure the Redis client will not hang.
=> true

irb(main):003:0> r = Redis.new
RuntimeError: -ERR unknown command
  from /usr/lib/ruby/gems/1.8/gems/redis-2.0.6/lib/redis/client.rb:172:in `format_error_reply'
  from /usr/lib/ruby/gems/1.8/gems/redis-2.0.6/lib/redis/client.rb:162:in `format_reply'
  from /usr/lib/ruby/gems/1.8/gems/redis-2.0.6/lib/redis/client.rb:105:in `read'
  from /usr/lib/ruby/gems/1.8/gems/redis-2.0.6/lib/redis/client.rb:35:in `call'
  from /usr/lib/ruby/gems/1.8/gems/redis-2.0.6/lib/redis/client.rb:63:in `process'
  from /usr/lib/ruby/gems/1.8/gems/redis-2.0.6/lib/redis/client.rb:245:in `ensure_connected'
  from /usr/lib/ruby/gems/1.8/gems/redis-2.0.6/lib/redis/client.rb:61:in `process'
  from /usr/lib/ruby/gems/1.8/gems/redis-2.0.6/lib/redis/client.rb:199:in `logging'
  from /usr/lib/ruby/gems/1.8/gems/redis-2.0.6/lib/redis/client.rb:60:in `process'
  from /usr/lib/ruby/gems/1.8/gems/redis-2.0.6/lib/redis/client.rb:34:in `call'
  from /usr/lib/ruby/gems/1.8/gems/redis-2.0.6/lib/redis.rb:51:in `info'
  from /usr/lib/ruby/gems/1.8/gems/redis-2.0.6/lib/redis.rb:560:in `inspect'
  from /usr/lib/ruby/1.8/irb.rb:302:in `output_value'
  from /usr/lib/ruby/1.8/irb.rb:151:in `eval_input'
  from /usr/lib/ruby/1.8/irb.rb:263:in `signal_status'
  from /usr/lib/ruby/1.8/irb.rb:147:in `eval_input'
  from /usr/lib/ruby/1.8/irb.rb:146:in `eval_input'
  from /usr/lib/ruby/1.8/irb.rb:70:in `start'
  from /usr/lib/ruby/1.8/irb.rb:69:in `catch'
  from /usr/lib/ruby/1.8/irb.rb:69:in `start'
  from /usr/bin/irb:13irb(main):004:0> exit

有没有人遇到过这个?有任何想法吗?

4

1 回答 1

2

如果您的 redis 是 9.10 发行版提供的版本,则版本太旧而无法使用 2.x gem 运行。2.x gem 至少需要一个 1.2 redis

于 2010-09-13T09:41:12.960 回答