yum install -y epel-release

yum install -y redis

vim /etc/redis.conf

修改:bind 0.0.0.0 

requirepass foobared123

systemctl restart redis

redis-cli

>>auth foobared123

 

import redis
 
pool = redis.ConnectionPool(host='192.168.1.144', port=6379,password='foobared123')
 
r = redis.Redis(connection_pool=pool)
r.set('test', 'Bar')
print r.get('test')
 
字符串操作:get(key) set(key,value)  mget(key) set(mkey,**kwargs)
hash操作:hget(name,key) hset(name,key,value)   hmget(name,key,**kwargs)
集合操作:sadd
列表操作:lpush 

相关文章:

  • 2022-01-21
  • 2021-11-14
  • 2021-10-11
  • 2021-05-29
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-02-11
  • 2021-08-17
  • 2022-12-23
  • 2022-12-23
  • 2022-01-07
相关资源
相似解决方案