环境:
Ubuntu 9.10(在VirtualBox中运行) Ruby v1.8.7 Redis gem v2.0.6
在irb上,当我尝试初始化Redis时,得到一个RuntimeError。这是一个片段:
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
有人遇到过吗?有任何想法吗?
如果您的redis是9.10发行版提供的版本,则该版本太旧而无法与2.x gem一起运行。2.x gem至少需要1.2 redis