steelThread / redmon

A web interface for managing redis: cli, admin, and live monitoring
http://steelthread.github.com/redmon/
1.57k stars 127 forks source link

undefined method `connect' for Redis:Class #99

Open DependencyHell opened 7 years ago

DependencyHell commented 7 years ago

Hi,

I just installed it with gem, but I've got this after starting with gem redmon

Thin web server (v1.7.2 codename Bachmanity)
Maximum connections set to 1024
Listening on 0.0.0.0:4567, CTRL+C to stop
[17-10-17 11:08:04] listening on http://0.0.0.0:4567/
[17-10-17 11:08:14] !!! Redmon has shit the bed, restarting... undefined method `connect' for Redis:Class
[17-10-17 11:08:14] /var/lib/gems/2.3.0/gems/redmon-0.0.13/lib/redmon/redis.rb:18:in `redis'
[17-10-17 11:08:14] /var/lib/gems/2.3.0/gems/redmon-0.0.13/lib/redmon/worker.rb:13:in `record_stats'
[17-10-17 11:08:14] /var/lib/gems/2.3.0/gems/redmon-0.0.13/lib/redmon/worker.rb:7:in `block in run!'
[17-10-17 11:08:14] /var/lib/gems/2.3.0/gems/eventmachine-1.2.5/lib/em/timers.rb:56:in `fire'
[17-10-17 11:08:14] /var/lib/gems/2.3.0/gems/eventmachine-1.2.5/lib/eventmachine.rb:194:in `call'
[17-10-17 11:08:14] /var/lib/gems/2.3.0/gems/eventmachine-1.2.5/lib/eventmachine.rb:194:in `run_machine'
[17-10-17 11:08:14] /var/lib/gems/2.3.0/gems/eventmachine-1.2.5/lib/eventmachine.rb:194:in `run'
[17-10-17 11:08:14] /var/lib/gems/2.3.0/gems/redmon-0.0.13/lib/redmon.rb:20:in `start_em'
[17-10-17 11:08:14] /var/lib/gems/2.3.0/gems/redmon-0.0.13/lib/redmon.rb:9:in `run'
[17-10-17 11:08:14] /var/lib/gems/2.3.0/gems/redmon-0.0.13/bin/redmon:84:in `<top (required)>'
[17-10-17 11:08:14] /usr/local/bin/redmon:23:in `load'
[17-10-17 11:08:14] /usr/local/bin/redmon:23:in `<main>'

What am I missing?

Redis server v=3.0.6 sha=00000000:0 malloc=jemalloc-3.6.0 bits=64 build=687a2a319020fa42

Thanks

lavaturtle commented 7 years ago

I think this is a version dependency issue. We started seeing this error when we upgraded the redis gem from 3.3.5 to 4.0.1. Rolling redis back to 3.3.5 fixed the issue for us.

xulongju commented 6 years ago

Hi : I installed redmon the same problem: Thin web server (v1.7.2 codename Bachmanity) Maximum connections set to 1024 Listening on 0.0.0.0:4567, CTRL + C to stop [17-12-05 15:00:45] listening on http://0.0.0.0:4567/ [17-12-05 15:00:55] !!! Redmon has shit the bed, restarting ... undefined method connect 'for Redis: Class [17-12-05 15:00:55] /usr/local/rvm/gems/ruby-2.4.1/gems/redmon-0.0.13/lib/redmon/redis.rb:18:inredis' [17-12-05 15:00:55] /usr/local/rvm/gems/ruby-2.4.1/gems/redmon-0.0.13/lib/redmon/worker.rb:13:in record_stats' [17-12-05 15:00:55] /usr/local/rvm/gems/ruby-2.4.1/gems/redmon-0.0.13/lib/redmon/worker.rb:7:inblock in run ! [17-12-05 15:00:55] /usr/local/rvm/gems/ruby-2.4.1/gems/eventmachine-1.2.5/lib/em/timers.rb:56:in fire ' [17-12-05 15:00:55] /usr/local/rvm/gems/ruby-2.4.1/gems/eventmachine-1.2.5/lib/eventmachine.rb:194:incall ' [17-12-05 15:00:55] /usr/local/rvm/gems/ruby-2.4.1/gems/eventmachine-1.2.5/lib/eventmachine.rb:194:in run_machine ' [17-12-05 15:00:55] /usr/local/rvm/gems/ruby-2.4.1/gems/eventmachine-1.2.5/lib/eventmachine.rb:194:inrun ' [17-12-05 15:00:55] /usr/local/rvm/gems/ruby-2.4.1/gems/redmon-0.0.13/lib/redmon.rb:20:in start_em ' [17-12-05 15:00:55] /usr/local/rvm/gems/ruby-2.4.1/gems/redmon-0.0.13/lib/redmon.rb:9:inrun ' [17-12-05 15:00:55] /usr/local/rvm/gems/ruby-2.4.1/gems/redmon-0.0.13/lib/redmon.rb:15:in rescue in run ' [17-12-05 15:00:55] /usr/local/rvm/gems/ruby-2.4.1/gems/redmon-0.0.13/lib/redmon.rb:8:inrun '

Version: Install redmon using the gem in ruby-2.4.1 redis: 2.8.22

Please help me check the problem, thank you.

xulongju commented 6 years ago

Already solved, Redis 4.0.1 downgraded to 3.3.5

amatriain commented 6 years ago

This error happens with redis gem versions from 4.0 onward. This is caused by the removal of the Redis#connect method, which was deprecated long ago. The fix is to use Redis#new instead, which is a straightforward replacement (#connect was just a wrapper around #new).

The commit in redis that removed #connect was https://github.com/redis/redis-rb/commit/895cc3211e335a8fd9ba9322cd311c09eea9621f#diff-54fab56a3b12825ac3ed9243b67fd459

That commit is over two years old. It's not acceptable being stuck with such an old redis.rb version.

I've added a PR that fixes this. https://github.com/steelThread/redmon/pull/101

romulogoncalves commented 4 years ago

Are we still locked to an old version of Redis?