sudoapt-getupdate sudoapt-getinstallmakegccpython-dev-y wgethttp://download.redis.io/releases/redis-3.2.8.tar.gz tarxzfredis-3.2.8.tar.gz cdredis-3.2.8 make sudomakeinstall #启动服务端 redis-serverredis.conf #启动客户端连接 ancongadmin@yancongadmin-All-Series:~/downloads/redis-3.2.8/src$./redis-cli 127.0.0.1:6379> 127.0.0.1:6379> 127.0.0.1:6379>setfoobar OK 127.0.0.1:6379>getfoo "bar" 127.0.0.1:6379> #Linux上为Python语言安装Redis客户端库 ~:$wget-qhttp://peak.telecommunity.com/dist/ez_setup.py#下载ez_setup模块 ~:$sudopythonez_setup.py#通过运行ez_setup模块来下载并安装setuptools。 Downloadinghttp://pypi.python.org/packages/2.7/s/setuptools/...# [trimmed]# Finishedprocessingdependenciesforsetuptools==0.6c11# ~:$sudopython-measy_installredishiredis#通过运行setuptools的easy_install包来安装redis包以及hiredis包。 Searchingforredis#redis包为Python提供了一个连接至Redis的接口。 [trimmed]# Finishedprocessingdependenciesforredis# Searchingforhiredis#hiredis包是一个C库,它可以提高Python的Redis客户端的速度。 [trimmed]# Finishedprocessingdependenciesforhiredis# ~:$ #使用Python来测试Redis $python Python2.7.12(default,Nov192016,06:48:10) [GCC5.4.020160609]onlinux2 Type"help","copyright","credits"or"license"formoreinformation. >>>importredis >>>conn=redis.Redis() >>>conn.set('hello','world') True >>>conn.get('hello') 'world' >>> redis使用key-value,键值 默认端口:6379
参考:
原文地址:https://www.jb51.cc/ubuntu/354033.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。