celery-redis密码连接问题
错误问题:
consumer: Cannot connect to amqp://guest:**@127.0.0.1:5672//: [WinError 10061] 由于目标计算机积极拒绝,无法连接。.
Trying again in 2.00 seconds... (1/100)
解决问题:
URL连接的格式为: redis://:password@hostname:port/db_number
例如:
任务队列的链接地址(变量名唯一)
broker_url = 'redis://:foobared@127.0.0.1:6379/6'
结果队列的链接地址(变量名唯一)
result_backend = 'redis://:foobared@127.0.0.1:6379/8'
执行命令: celery -A main worker --loglevel=info
-------------- celery@DESKTOP-RIBVNKO v4.4.3 (cliffs)
--- ***** -----
-- ******* ---- Windows-10-10.0.18362-SP0 2020-06-01 21:10:07
- *** --- * ---
- ** ---------- [config]
- ** ---------- .> app: luffy:0x1533b361240
- ** ---------- .> transport: redis://😗*@127.0.0.1:6379/6
- ** ---------- .> results: redis://😗*@127.0.0.1:6379/8
- *** --- * --- .> concurrency: 8 (prefork)
-- ******* ---- .> task events: OFF (enable -E to monitor tasks in this worker)
--- ***** -----
-------------- [queues]
.> celery exchange=celery(direct) key=celery
[tasks]
. mycelery.sms.tasks.send_sms
[2020-06-01 21:10:08,025: INFO/MainProcess] Connected to redis://😗*@127.0.0.1:6379/6
[2020-06-01 21:10:08,045: INFO/MainProcess] mingle: searching for neighbors
[2020-06-01 21:10:08,125: INFO/SpawnPoolWorker-1] child process 19976 calling self.run()
[2020-06-01 21:10:08,166: INFO/SpawnPoolWorker-2] child process 1136 calling self.run()
[2020-06-01 21:10:08,230: INFO/SpawnPoolWorker-3] child process 22676 calling self.run()
[2020-06-01 21:10:08,289: INFO/SpawnPoolWorker-4] child process 6460 calling self.run()
[2020-06-01 21:10:08,349: INFO/SpawnPoolWorker-5] child process 20808 calling self.run()
[2020-06-01 21:10:08,398: INFO/SpawnPoolWorker-6] child process 17800 calling self.run()
[2020-06-01 21:10:08,423: INFO/SpawnPoolWorker-7] child process 24296 calling self.run()
[2020-06-01 21:10:08,486: INFO/SpawnPoolWorker-8] child process 17604 calling self.run()
[2020-06-01 21:10:09,084: INFO/MainProcess] mingle: all alone
[2020-06-01 21:10:09,093: INFO/MainProcess] celery@DESKTOP-RIBVNKO ready.