windows
下载
https://github.com/tporadowski/redis/releases
安装启动即可
centos
去地址查找最新的的版本,或者适合自己的
http://download.redis.io/releases
然后
wget http://download.redis.io/releases/redis-6.2.1.tar.gz
解压
tar zxvf redis-6.2.1.tar.gz
编译
cd redis-6.2.1 make && make install
编辑配置文件
vim redis.conf
启动
redis-server /usr/local/redis-6.2.1/redis.conf
依赖
yum install -y gcc
树莓派
apt-get update apt install -y redis-server service redis start
简单使用
import redis
config = {
'host': '127.0.0.1',
'port': 6379,
'decode_responses': True
}
def redis_pool():
pool = redis.ConnectionPool(**config)
r = redis.Redis(connection_pool=pool)
print(r)
r.set('domain', 'http://heanny.cn')
print(r.get('domain'))
暂无评论,还不快来坐沙发...