Install Redis in WSL

1
2
3
4
5
6
7
8
9
curl -fsSL https://packages.redis.io/gpg | sudo gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg
sudo apt-get update
sudo apt-get install redis
 
# start server
redis-server
 
redis-cli
	config set requirepass 123123

Redis in python,

1
2
3
4
5
6
import redis
 
redis_pool = redis.ConnectionPool(host='127.0.0.1', port=6379, password='123123')
redis_conn = redis.Redis(connection_pool=redis_pool)
redis_conn.set('name_2', 'Zarten_2')
redis_conn.get('name_2')

Redis in Windows, https://github.com/tporadowski/redis/releases

redis.windows.conf
	#bind 127.0.0.1
	protected-mode no
	requirepass 123456
 
redis-server.exe redis.windows.conf
 
redis-cli -h 192.168.10.111 -p 6379

refer to:
https://www.jianshu.com/p/ec8b749cd842
https://blog.csdn.net/weixin_30456039/article/details/97497620
https://blog.csdn.net/csdnhxs/article/details/122450575