sripathikrishnan / redis-rdb-tools

Parse Redis dump.rdb files, Analyze Memory, and Export Data to JSON
https://rdbtools.com
MIT License
5.07k stars 739 forks source link

Invalid RDB version number 9 while extracting redis dump #161

Open alokch18 opened 4 years ago

alokch18 commented 4 years ago

Hi Krishnan,

We are trying to extract the redis dump through your tool "redis-rdb-tools" but we are getting the below error while executing "rdb --command json /home/gstjdgusr/Redis_rdb_Tool/bk20200207-120000-6-GstMasterDb-1_of_2-16-1-2048.rdb > GstMasterDb_DC1_01.txt" under path "/home/gstjdgusr/Redis_rdb_Tool/redis-rdb-tools-master".

Kindly help us to resolve the same.

Traceback (most recent call last): File "/usr/bin/rdb", line 9, in load_entry_point('rdbtools==0.1.11', 'console_scripts', 'rdb')() File "/usr/lib/python2.7/site-packages/rdbtools-0.1.11-py2.7.egg/rdbtools/cli/rdb.py", line 86, in main parser.parse(dump_file) File "/usr/lib/python2.7/site-packages/rdbtools-0.1.11-py2.7.egg/rdbtools/parser.py", line 350, in parse self.parse_fd(open(filename, "rb")) File "/usr/lib/python2.7/site-packages/rdbtools-0.1.11-py2.7.egg/rdbtools/parser.py", line 355, in parse_fd self.verify_version(f.read(4)) File "/usr/lib/python2.7/site-packages/rdbtools-0.1.11-py2.7.egg/rdbtools/parser.py", line 816, in verify_version raise Exception('verify_version', 'Invalid RDB version number %d' % version) Exception: ('verify_version', 'Invalid RDB version number 9')

Regards, Alok

oranagra commented 4 years ago

@alokch18 it looks like maybe you're using an old version of redis-rdb-tools. rdb version 9 (Redis 5.0) is supported long ago.

alokch18 commented 4 years ago

Hi Oranagra,

I downloaded a package from the site itself for which I'm getting the same error. Can you please share the link to download the latest package.

oranagra commented 4 years ago

@alokch18 this is the latest release: https://github.com/sripathikrishnan/redis-rdb-tools/archive/rdbtools-0.1.14.tar.gz

alokch18 commented 4 years ago

@oranagra , Thanks for the link for latest release but I'm getting the same error as before when I used the latest package. It seems that it is using the old tool only even though I have moved the previous tool in different directory altogether. Also, kindly let us know if we need to install the tool post copying , unzipping and after doing tar -xvf "tool_name".

[gstjdgusr@TRNJDGD1 Redis_rdb_Tool]$ rdb --command json /home/gstjdgusr/Redis_rdb_Tool/bk20200207-120000-6-GstMasterDb-1_of_2-16-1-2048.rdb > GstMasterDb_DC1_02.txt Traceback (most recent call last): File "/usr/bin/rdb", line 9, in load_entry_point('rdbtools==0.1.11', 'console_scripts', 'rdb')() File "/usr/lib/python2.7/site-packages/rdbtools-0.1.11-py2.7.egg/rdbtools/cli/rdb.py", line 86, in main parser.parse(dump_file) File "/usr/lib/python2.7/site-packages/rdbtools-0.1.11-py2.7.egg/rdbtools/parser.py", line 350, in parse self.parse_fd(open(filename, "rb")) File "/usr/lib/python2.7/site-packages/rdbtools-0.1.11-py2.7.egg/rdbtools/parser.py", line 355, in parse_fd self.verify_version(f.read(4)) File "/usr/lib/python2.7/site-packages/rdbtools-0.1.11-py2.7.egg/rdbtools/parser.py", line 816, in verify_version raise Exception('verify_version', 'Invalid RDB version number %d' % version) Exception: ('verify_version', 'Invalid RDB version number 9')

oranagra commented 4 years ago

@alokch18 yes, you need to install the tool, the rdb command you run isn't executed from the current directory.. do which rdb and you'll see. maybe you just need to pip install --upgrade rdbtools?

bottom line, you'll need to either find out how you installed it and upgrade it. or if you want, you can run it from source using something like this:

env PYTHONPATH=`pwd` python rdbtools/cli/rdb.py --command json file.rdb
alokch18 commented 4 years ago

@oranagra When I tried to install using command "pip install --upgrade rdbtools", I got the below mentioned response.

Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7fc6b43ce910>, 'Connection to pypi.org timed out. (connect timeout=15)')': /simple/rdbtools/ Requirement already up-to-date: rdbtools in /usr/lib/python2.7/site-packages/rdbtools-0.1.11-py2.7.egg (0.1.11) Requirement already satisfied, skipping upgrade: redis in /usr/lib/python2.7/site-packages/redis-2.7.3-py2.7.egg (from rdbtools) (2.7.3)

However, when I retried the conversion, I got the same error as mentioned before, i.e., Invalid RDB version number 9'.

oranagra commented 4 years ago

@alokch18 i don't know what's wrong with your pip. when i try to install rdbtools i get the right version, which is 0.1.14 (see https://pypi.org/project/rdbtools/)

sksksksksksksk commented 3 years ago

I ran into this issue myself, and I discovered PyPI doesn't have an up-to-date rdbtools available for Python 2.

Python3 and pip3 work just fine.

pip3 install --upgrade rdbtools # should take care of this issue.