Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

redis - ERR unknown command 'HELLO' (RedisClient::CommandError)

Tags:

ruby

redis

"I have enabled Redis locally, but an error occurred while running the script. What should I do to resolve this?"

/home/linlin/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/redis-client-0.11.1/lib/redis_client/connection_mixin.rb:48:in `call_pipelined': ERR unknown command 'HELLO' (RedisClient::CommandError)
    from /home/linlin/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/redis-client-0.11.1/lib/redis_client.rb:678:in `block in connect'
    from /home/linlin/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/redis-client-0.11.1/lib/redis_client/middlewares.rb:16:in `call'
    from /home/linlin/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/redis-client-0.11.1/lib/redis_client.rb:677:in `connect'
    from /home/linlin/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/redis-client-0.11.1/lib/redis_client.rb:647:in `raw_connection'
    from /home/linlin/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/redis-client-0.11.1/lib/redis_client.rb:614:in `ensure_connected'
    from /home/linlin/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/redis-client-0.11.1/lib/redis_client.rb:349:in `pipelined'
    from /home/linlin/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/redis-client-0.11.1/lib/redis_client/decorator.rb:51:in `pipelined'
    from /home/linlin/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/sidekiq-7.0.1/lib/sidekiq/client.rb:214:in `block in raw_push'
    from /home/linlin/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/connection_pool-2.3.0/lib/connection_pool.rb:65:in `block (2 levels) in with'
    from /home/linlin/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/connection_pool-2.3.0/lib/connection_pool.rb:64:in `handle_interrupt'
    from /home/linlin/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/connection_pool-2.3.0/lib/connection_pool.rb:64:in `block in with'
    from /home/linlin/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/connection_pool-2.3.0/lib/connection_pool.rb:61:in `handle_interrupt'
    from /home/linlin/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/connection_pool-2.3.0/lib/connection_pool.rb:61:in `with'
    from /home/linlin/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/sidekiq-7.0.1/lib/sidekiq/client.rb:211:in `raw_push'
    from /home/linlin/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/sidekiq-7.0.1/lib/sidekiq/client.rb:92:in `push'
    from /home/linlin/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/sidekiq-7.0.1/lib/sidekiq/job.rb:365:in `client_push'
    from /home/linlin/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/sidekiq-7.0.1/lib/sidekiq/job.rb:198:in `perform_async'
    from /home/linlin/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/sidekiq-7.0.1/lib/sidekiq/job.rb:290:in `perform_async'

like image 665
zero20210602 Avatar asked Dec 16 '25 12:12

zero20210602


1 Answers

Setting the protocol version to 2 will resolve the error for most of the cases, or you can choose to upgrade the redis-client version above 6.

The redis protocol version can be set to either 1 or 2.

Protocol version 2 is an enhanced protocol version introduced in Redis 6.0.

You can add the protocol something like below to redis config,

Sidekiq.configure_client do |config|
  config.redis = {
    url: Rails.application.credentials.config[:REDIS_URL],
    protocol: 2,
  }
end
like image 65
Lakshmaji Avatar answered Dec 19 '25 05:12

Lakshmaji