Mac下安装redis-rdb-tools工具

1.Mac安装包管理工具Homebrew:

$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

2.安装Python

3.安装pip 

$ sudo easy_install pip

Password:
Searching for pip
Reading https://pypi.python.org/simple/pip/
Best match: pip 19.2.1
Downloading https://files.pythonhosted.org/packages/8b/8a/1b2aadd922db1afe6bc107b03de41d6d37a28a5923383e60695fba24ae81/pip-19.2.1.tar.gz#sha256=258d702483dd749400aec59c23d638a5b2249ae28a0f478b6cab12ad45681a80
Processing pip-19.2.1.tar.gz
Writing /tmp/easy_install-LzBpsZ/pip-19.2.1/setup.cfg
Running pip-19.2.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-LzBpsZ/pip-19.2.1/egg-dist-tmp-AY7i6k
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'python_requires'
warnings.warn(msg)
warning: no files found matching 'docs/docutils.conf'
warning: no previously-included files found matching '.coveragerc'
warning: no previously-included files found matching '.mailmap'
warning: no previously-included files found matching '.appveyor.yml'
warning: no previously-included files found matching '.travis.yml'
warning: no previously-included files found matching 'tox.ini'
warning: no files found matching 'Makefile' under directory 'docs'
warning: no files found matching '.bat' under directory 'docs'
warning: no previously-included files found matching 'src/pip/_vendor/six'
warning: no previously-included files found matching 'src/pip/_vendor/six/moves'
warning: no previously-included files matching '
.pyi' found under directory 'src/pip/_vendor'
no previously-included directories found matching '.github'
no previously-included directories found matching '.azure-pipelines'
no previously-included directories found matching 'docs/build'
no previously-included directories found matching 'news'
no previously-included directories found matching 'tasks'
no previously-included directories found matching 'tests'
no previously-included directories found matching 'tools'
creating /Library/Python/2.7/site-packages/pip-19.2.1-py2.7.egg
Extracting pip-19.2.1-py2.7.egg to /Library/Python/2.7/site-packages
Adding pip 19.2.1 to easy-install.pth file
Installing pip script to /usr/local/bin
Installing pip2.7 script to /usr/local/bin
Installing pip2 script to /usr/local/bin

Installed /Library/Python/2.7/site-packages/pip-19.2.1-py2.7.egg
Processing dependencies for pip
Finished processing dependencies for pip

4.安装redis-rdb-tools

$ sudo pip install rdbtools

DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
WARNING: The directory '/Users/dragon/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
WARNING: The directory '/Users/dragon/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting rdbtools
Downloading https://files.pythonhosted.org/packages/16/2d/0389de4b615dfe456715444d2c56ff538cf9bf5b1df87ac2ab558064e52d/rdbtools-0.1.14.tar.gz
Collecting redis (from rdbtools)
Downloading https://files.pythonhosted.org/packages/94/7a/c0d83bf432d07c567857f21b9d3e598c8c0cfad0a2dbf24d61d952f168c1/redis-3.3.5-py2.py3-none-any.whl (65kB)
|████████████████████████████████| 71kB 112kB/s
Installing collected packages: redis, rdbtools
Running setup.py install for rdbtools ... done
Successfully installed rdbtools-0.1.14 redis-3.3.5

$ rdb -h****

Usage: rdb [options] /path/to/dump.rdb

Example : rdb --command json -k "user.*" /var/redis/6379/dump.rdb

Options:
-h, --help show this help message and exit
-c FILE, --command=FILE
Command to execute. Valid commands are json, diff,
justkeys, justkeyvals, memory and protocol
-f FILE, --file=FILE Output file
-n DBS, --db=DBS Database Number. Multiple databases can be provided.
If not specified, all databases will be included.
-k KEYS, --key=KEYS Keys to export. This can be a regular expression
-o NOT_KEYS, --not-key=NOT_KEYS
Keys Not to export. This can be a regular expression
-t TYPES, --type=TYPES
Data types to include. Possible values are string,
hash, set, sortedset, list. Multiple typees can be
provided. If not specified, all
data types will be returned
-b BYTES, --bytes=BYTES
Limit memory output to keys greater to or equal to
this value (in bytes)
-l LARGEST, --largest=LARGEST
Limit memory output to only the top N keys (by size)
-e ESCAPE, --escape=ESCAPE
Escape strings to encoding: raw (default), print,
utf8, or base64.

猜你喜欢

转载自blog.51cto.com/zhaowl/2427098