查找redis
suse# whereis redis
redis: /usr/ports/databases/redis
安装redis
suse# make
suse# make install
启动
suse# /usr/local/bin/redis-server
[6314] 19 Dec 00:22:06 # Warning: no config file specified, using the default config. In order to specify a config file use 'redis-server /path/to/redis.conf'
[6314] 19 Dec 00:22:06 * Server started, Redis version 2.2.15
[6314] 19 Dec 00:22:06 * The server is now ready to accept connections on port 6379
[6314] 19 Dec 00:22:06 - 0 clients connected (0 slaves), 621464 bytes in use
安装 python redis
git clone https://github.com/andymccurdy/redis-py.git
suse# cd redis-py/
suse# python setup.py install
或者
[suse# easy_install redis
Searching for redis
Best match: redis 2.4.10
Adding redis 2.4.10 to easy-install.pth file
Using /usr/local/lib/python2.7/site-packages
Processing dependencies for redis
Finished processing dependencies for redis]
安装ipython
suse# whereis ipython
ipython: /usr/ports/devel/ipython
suse# cd /usr/ports/devel/ipython
suse# make
suse# make install
安装 setup-tools
suse# wget http://pypi.python.org/packages/2.7/s/setuptools/setuptools-0.6c11-py2.7.egg
--2011-12-19 00:28:39-- http://pypi.python.org/packages/2.7/s/setuptools/setuptools-0.6c11-py2.7.egg
Resolving pypi.python.org (pypi.python.org)... 82.94.164.168, 2001:888:2000:d::a8
Connecting to pypi.python.org (pypi.python.org)|82.94.164.168|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 332005 (324K) [application/octet-stream]
Saving to: `setuptools-0.6c11-py2.7.egg'
100%[==================================================================================================================>] 332,005 38.7K/s in 8.4s
2011-12-19 00:28:49 (38.7 KB/s) - `setuptools-0.6c11-py2.7.egg' saved [332005/332005]
suse# sh setuptools-0.6c11-py2.7.egg
Processing setuptools-0.6c11-py2.7.egg
Copying setuptools-0.6c11-py2.7.egg to /usr/local/lib/python2.7/site-packages
Adding setuptools 0.6c11 to easy-install.pth file
Installing easy_install script to /usr/local/bin
Installing easy_install-2.7 script to /usr/local/bin
Installed /usr/local/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg
Processing dependencies for setuptools==0.6c11
Finished processing dependencies for setuptools==0.6c11
开始体验:
开启redis server
suse# /usr/local/bin/redis-server
[32692] 19 Dec 00:31:17 # Warning: no config file specified, using the default config. In order to specify a config file use 'redis-server /path/to/redis.conf'
[32692] 19 Dec 00:31:17 * Server started, Redis version 2.2.15
[32692] 19 Dec 00:31:17 * The server is now ready to accept connections on port 6379
[32692] 19 Dec 00:31:17 - 0 clients connected (0 slaves), 621464 bytes in use
suse# python
Python 2.7.2 (default, Nov 22 2011, 22:07:16)
[GCC 4.2.1 20070831 patched [FreeBSD]] on freebsd9
Type "help", "copyright", "credits" or "license" for more information.
>>> import redis
>>> r = redis.StrictRedis(host='localhost',port=6379,db=0)
>>> r.set('foo','bar')
True
>>> r.get('foo')
'bar'
看样子还不错哦,其他的还没有尝试。