第一个Celery程序
来自CloudWiki
Redis配置和启动
我们以Redis为例,首先修改Redis配置文件redis.conf,修改bind = 127.0.0.0.1为bind =0.0.0.0,意思是允许远程访问Redis数据库。
redis-4.0.11/redis.conf
bind 0.0.0.0
接下来启动Redis
cd src
./redis-server ../redis.conf
[root@localhost src]# ps -ef |grep redis
root 84370 80953 0 12:07 pts/2 00:00:00 ./redis-server 0.0.0.0:6379 root 84388 84206 0 12:11 pts/3 00:00:00 grep --color=auto redis
python配置redis模块
[root@localhost op]# pip3 install redis
[root@localhost op]# python3
Python 3.7.5 (default, May 8 2020, 10:08:52) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import redis >>> r = redis.Redis(host='localhost',port=6379,db=0) >>> r.set('foo','bar') True >>> r.get('foo') b'bar' >>> exit()