nkrode / RedisLive

Visualize your redis instances, analyze query patterns and spikes.
http://www.nkrode.com/article/real-time-dashboard-for-redis
MIT License
3.07k stars 644 forks source link

File "./redis-monitor.py", line 206, in run #103

Open MyselfWarmHome opened 5 years ago

MyselfWarmHome commented 5 years ago

Traceback (most recent call last):

File "./redis-monitor.py", line 206, in run used_memory, peak_memory) File "/home/omsadmin/redis-monitor/nkrode-RedisLive-e1d7763/src/dataprovider/redisprovider.py", line 30, in save_memory_info self.conn.zadd(server + ":memory", str(timeutils.convert_to_epoch(timestamp)), data) File "/usr/local/python/lib/python2.7/site-packages/redis/client.py", line 2263, in zadd for pair in iteritems(mapping): File "/usr/local/python/lib/python2.7/site-packages/redis/_compat.py", line 94, in iteritems return x.iteritems() AttributeError: 'str' object has no attribute 'iteritems'

nonomal commented 5 years ago

@MyselfWarmHome Have you solved it?

greatvovan commented 5 years ago

@MyselfWarmHome, @nonomal Revert the latest version of redis lib to a 2.. (e.g. 2.10.6). The API has changed: https://pypi.org/project/redis/#description

The proper fix would be changing the code, but I don't want to touch this old version of Python...

nonomal commented 5 years ago

@greatvovan “Revert the latest version of redis lib to a 2.. (e.g. 2.10.6)” I don't quite understand, is the version of Redis that I upgraded?

I used redis3.2.6, you said that the 2.10.6 version made me doubt, my python is 2.7.15 (I just thought that there is a problem with the default 2.7.5 version), so I hope to get the answer.

greatvovan commented 5 years ago

@nonomal I did not say that the 2.10.6 version made you doubt.

I am saying, if you are experiencing the same problem as in the one in the first post, it is due to Redis library version (it is called redis and specified without version in the requirements.txt file). Since the version 3.*.* they changed API, which causes the problem. It has nothing to do with your Python version.

nonomal commented 5 years ago

@greatvovan Thank you very much, I use the command: Pip uninstall redis Pip install -v redis==2.10.6 Successfully solved this problem, thank you

I hope I can contact the redislive author to coordinate the problem. Is there any plan for this?

zanxu2016 commented 4 years ago

I have the same problem.Here is my solution. Open the file

redisprovider.py

in the directory of

.../src/dataprovider

, around line 30 is the code

self.conn.zadd(server + ":memory", str(timeutils.convert_to_epoch(timestamp)), data)

. Try to remove the second paramter

str(timeutils.convert_to_epoch(timestamp))

, and leave the code like

self.conn.zadd(server + ":memory", data)

. Then the problem has gone.