aioredis.errors.replyerror:尝试使用redis时出现未知命令'bzpopmin'

zlhcx6iw  于 2021-06-08  发布在  Redis
关注(0)|答案(0)|浏览(534)

我有redis 5.4。我犯了一个错误: aioredis.errors.ReplyError: ERR unknown command 'BZPOPMIN' 我正在关注django频道网站上的教程。这是消费者代码:

  1. class ChatConsumer(WebsocketConsumer):
  2. def connect(self):
  3. self.room_name = self.scope['url_route']['kwargs']['room_name']
  4. self.room_group_name = 'chat_%s' % self.room_name
  5. # Join room group
  6. async_to_sync(self.channel_layer.group_add)(
  7. self.room_group_name,
  8. self.channel_name
  9. )
  10. self.accept()
  11. def disconnect(self, close_code):
  12. # Leave room group
  13. async_to_sync(self.channel_layer.group_discard)(
  14. self.room_group_name,
  15. self.channel_name
  16. )
  17. # Receive message from WebSocket
  18. def receive(self, text_data):
  19. text_data_json = json.loads(text_data)
  20. message = text_data_json['message']
  21. # Send message to room group
  22. async_to_sync(self.channel_layer.group_send)(
  23. self.room_group_name,
  24. {
  25. 'type': 'chat_message',
  26. 'message': message
  27. }
  28. )
  29. # Receive message from room group
  30. def chat_message(self, event):
  31. message = event['message']
  32. # Send message to WebSocket
  33. self.send(text_data=json.dumps({
  34. 'message': message
  35. }))

我使用 python manage.py runserver 0.0.0.0:8080 -- noreload 也许这与此有关,我打开5656端口上的页面,它在8080上托管,因为我正在使用vagrant,这些是vagrant文件中设置的端口。
编辑不知道为什么,但是如果我检查pip freeze上redis服务器的版本,我会得到(.venv)vagrant@vagrant:/vagrant/chatapp$redis server--version redis server v=4.0.9 sha=00000000:0 malloc=jemalloc-3.6.0 bits=64 build=9435c3c2879311f3,但我不知道为什么会这样,以及如何修复它。
pip feeeze输出:

  1. aioredis==1.3.1
  2. asgiref==3.2.10
  3. async-timeout==3.0.1
  4. attrs==20.1.0
  5. autobahn==20.7.1
  6. Automat==20.2.0
  7. certifi==2020.6.20
  8. cffi==1.14.2
  9. channels==2.4.0
  10. channels-redis==3.0.1
  11. chardet==3.0.4
  12. constantly==15.1.0
  13. cryptography==3.0
  14. daphne==2.5.0
  15. Django==3.1
  16. django-channels==0.7.0
  17. hiredis==1.1.0
  18. hyperlink==20.0.1
  19. idna==2.10
  20. incremental==17.5.0
  21. msgpack==1.0.0
  22. oauthlib==3.1.0
  23. pyasn1==0.4.8
  24. pyasn1-modules==0.2.8
  25. pycparser==2.20
  26. PyHamcrest==2.0.2
  27. pyOpenSSL==19.1.0
  28. pytz==2020.1
  29. redis-server==5.0.7
  30. requests==2.24.0
  31. requests-oauthlib==1.3.0
  32. service-identity==18.1.0
  33. six==1.15.0
  34. sqlparse==0.3.1
  35. Twisted==20.3.0
  36. txaio==20.4.1
  37. urllib3==1.25.10
  38. zope.interface==5.1.0

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题