heroku redis 错误:需要 NOAUTH 身份验证

heroku redis 错误:需要 NOAUTH 身份验证

我想将我的 django 项目部署到 heroku。我的项目使用频道所以我需要设置澳大利亚地理信息系统基础环境。

我在 Heroku 应用中安装了两个附加组件。一个是Heroku-postgresql另一个是Heroku-redis

我有两个测功机,请参阅下图。

附加组件,测功机:

在此处输入图片描述

我成功将 django 项目推送到 heroku git 上。$ git push heroku master

构建、部署:

在此处输入图片描述

这样,我得到了 url 地址。URL : demo-multichat.herokuapp.com

如果您访问该网址,您将遇到应用程序错误。

我使用以下方式收到日志消息$ heroku logs. Below is log messages.

2017-09-08T11:54:50.421663+00:00 app[web.1]: 2017-09-08 20:54:50,421 ERROR    Error trying to receive messages: NOAUTH Authentication required.
2017-09-08T11:54:55.424117+00:00 app[web.1]: 2017-09-08 20:54:55,423 ERROR    Error trying to receive messages: NOAUTH Authentication required.
2017-09-08T11:55:00.426387+00:00 app[web.1]: 2017-09-08 20:55:00,426 ERROR    Error trying to receive messages: NOAUTH Authentication required.
2017-09-08T11:55:05.428815+00:00 app[web.1]: 2017-09-08 20:55:05,428 ERROR    Error trying to receive messages: NOAUTH Authentication required.
2017-09-08T11:55:10.430511+00:00 app[web.1]: 2017-09-08 20:55:10,430 ERROR    Error trying to receive messages: NOAUTH Authentication required.
2017-09-08T11:55:15.432112+00:00 app[web.1]: 2017-09-08 20:55:15,431 ERROR    Error trying to receive messages: NOAUTH Authentication required.
2017-09-08T11:55:18.486722+00:00 heroku[worker.1]: State changed from crashed to starting
2017-09-08T11:55:20.434001+00:00 app[web.1]: 2017-09-08 20:55:20,433 ERROR    Error trying to receive messages: NOAUTH Authentication required.
2017-09-08T11:55:22.996928+00:00 heroku[worker.1]: Starting process with command `python manage.py runworker`
2017-09-08T11:55:23.685971+00:00 heroku[worker.1]: State changed from starting to up
2017-09-08T11:55:25.435766+00:00 app[web.1]: 2017-09-08 20:55:25,435 ERROR    Error trying to receive messages: NOAUTH Authentication required.
2017-09-08T11:55:27.264386+00:00 app[worker.1]: 2017-09-08 20:55:27,264 - INFO - runworker - Using single-threaded worker.
2017-09-08T11:55:27.264803+00:00 app[worker.1]: 2017-09-08 20:55:27,264 - INFO - runworker - Running worker against channel layer default (asgi_redis.core.RedisChannelLayer)
2017-09-08T11:55:27.265237+00:00 app[worker.1]: 2017-09-08 20:55:27,264 - INFO - worker - Listening on channels chat.receive, http.request, websocket.connect, websocket.disconnect, websocket.receive
2017-09-08T11:55:27.276810+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/redis/connection.py", line 484, in connect
2017-09-08T11:55:27.277217+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/redis/connection.py", line 541, in _connect
2017-09-08T11:55:27.277631+00:00 app[worker.1]:     raise err
2017-09-08T11:55:27.276796+00:00 app[worker.1]: Traceback (most recent call last):
2017-09-08T11:55:27.277635+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/redis/connection.py", line 529, in _connect
2017-09-08T11:55:27.277992+00:00 app[worker.1]:     sock.connect(socket_address)
2017-09-08T11:55:27.278042+00:00 app[worker.1]: ConnectionRefusedError: [Errno 111] Connection refused
2017-09-08T11:55:27.277199+00:00 app[worker.1]:     sock = self._connect()
2017-09-08T11:55:27.278044+00:00 app[worker.1]: 
2017-09-08T11:55:27.278045+00:00 app[worker.1]: During handling of the above exception, another exception occurred:
2017-09-08T11:55:27.278045+00:00 app[worker.1]: 
2017-09-08T11:55:27.278049+00:00 app[worker.1]: Traceback (most recent call last):
2017-09-08T11:55:27.278050+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/redis/client.py", line 667, in execute_command
2017-09-08T11:55:27.278455+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/redis/connection.py", line 610, in send_command
2017-09-08T11:55:27.278453+00:00 app[worker.1]:     connection.send_command(*args)
2017-09-08T11:55:27.278858+00:00 app[worker.1]:     self.send_packed_command(self.pack_command(*args))
2017-09-08T11:55:27.278862+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/redis/connection.py", line 585, in send_packed_command
2017-09-08T11:55:27.279107+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/redis/connection.py", line 489, in connect
2017-09-08T11:55:27.279104+00:00 app[worker.1]:     self.connect()
2017-09-08T11:55:27.279337+00:00 app[worker.1]: redis.exceptions.ConnectionError: Error 111 connecting to localhost:6379. Connection refused.
2017-09-08T11:55:27.279322+00:00 app[worker.1]:     raise ConnectionError(self._error_message(e))
2017-09-08T11:55:27.279338+00:00 app[worker.1]: 
2017-09-08T11:55:27.279339+00:00 app[worker.1]: During handling of the above exception, another exception occurred:
2017-09-08T11:55:27.279339+00:00 app[worker.1]: 
2017-09-08T11:55:27.279340+00:00 app[worker.1]: Traceback (most recent call last):
2017-09-08T11:55:27.279340+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/redis/connection.py", line 484, in connect
2017-09-08T11:55:27.279538+00:00 app[worker.1]:     sock = self._connect()
2017-09-08T11:55:27.279541+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/redis/connection.py", line 541, in _connect
2017-09-08T11:55:27.279757+00:00 app[worker.1]:     raise err
2017-09-08T11:55:27.279760+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/redis/connection.py", line 529, in _connect
2017-09-08T11:55:27.279971+00:00 app[worker.1]:     sock.connect(socket_address)
2017-09-08T11:55:27.279974+00:00 app[worker.1]: ConnectionRefusedError: [Errno 111] Connection refused
2017-09-08T11:55:27.279976+00:00 app[worker.1]: 
2017-09-08T11:55:27.279977+00:00 app[worker.1]: During handling of the above exception, another exception occurred:
2017-09-08T11:55:27.279978+00:00 app[worker.1]: 
2017-09-08T11:55:27.279991+00:00 app[worker.1]: Traceback (most recent call last):
2017-09-08T11:55:27.279993+00:00 app[worker.1]:   File "manage.py", line 10, in <module>
2017-09-08T11:55:27.280072+00:00 app[worker.1]:     execute_from_command_line(sys.argv)
2017-09-08T11:55:27.280083+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/django/core/management/__init__.py", line 363, in execute_from_command_line
2017-09-08T11:55:27.280251+00:00 app[worker.1]:     utility.execute()
2017-09-08T11:55:27.280254+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/django/core/management/__init__.py", line 355, in execute
2017-09-08T11:55:27.280421+00:00 app[worker.1]:     self.fetch_command(subcommand).run_from_argv(self.argv)
2017-09-08T11:55:27.280424+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/django/core/management/base.py", line 283, in run_from_argv
2017-09-08T11:55:27.280590+00:00 app[worker.1]:     self.execute(*args, **cmd_options)
2017-09-08T11:55:27.280591+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/django/core/management/base.py", line 330, in execute
2017-09-08T11:55:27.280762+00:00 app[worker.1]:     output = self.handle(*args, **options)
2017-09-08T11:55:27.280763+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/channels/management/commands/runworker.py", line 83, in handle
2017-09-08T11:55:27.280878+00:00 app[worker.1]:     worker.run()
2017-09-08T11:55:27.280879+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/channels/worker.py", line 87, in run
2017-09-08T11:55:27.280972+00:00 app[worker.1]:     channel, content = self.channel_layer.receive_many(channels, block=True)
2017-09-08T11:55:27.280973+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/asgiref/base_layer.py", line 43, in receive_many
2017-09-08T11:55:27.282189+00:00 app[worker.1]:     return self.receive(channels, block)
2017-09-08T11:55:27.282191+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/asgi_redis/core.py", line 215, in receive
2017-09-08T11:55:27.282191+00:00 app[worker.1]:     result = connection.blpop(list_names, timeout=self.blpop_timeout)
2017-09-08T11:55:27.282192+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/redis/client.py", line 1269, in blpop
2017-09-08T11:55:27.282193+00:00 app[worker.1]:     return self.execute_command('BLPOP', *keys)
2017-09-08T11:55:27.282193+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/redis/client.py", line 673, in execute_command
2017-09-08T11:55:27.282194+00:00 app[worker.1]:     connection.send_command(*args)
2017-09-08T11:55:27.282195+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/redis/connection.py", line 610, in send_command
2017-09-08T11:55:27.282196+00:00 app[worker.1]:     self.send_packed_command(self.pack_command(*args))
2017-09-08T11:55:27.282196+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/redis/connection.py", line 585, in send_packed_command
2017-09-08T11:55:27.282453+00:00 app[worker.1]:     self.connect()
2017-09-08T11:55:27.282454+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/redis/connection.py", line 489, in connect
2017-09-08T11:55:27.282744+00:00 app[worker.1]:     raise ConnectionError(self._error_message(e))
2017-09-08T11:55:27.282772+00:00 app[worker.1]: redis.exceptions.ConnectionError: Error 111 connecting to localhost:6379. Connection refused.
2017-09-08T11:55:27.459143+00:00 heroku[worker.1]: State changed from up to crashed
2017-09-08T11:55:27.446333+00:00 heroku[worker.1]: Process exited with status 1
2017-09-08T11:55:10+00:00 app[heroku-redis]: source=REDIS sample#active-connections=2 sample#load-avg-1m=0.315 sample#load-avg-5m=0.21 sample#load-avg-15m=0.16 sample#read-iops=0 sample#write-iops=0 sample#memory-total=15664264kB sample#memory-free=11905356kB sample#memory-cached=961068kB sample#memory-redis=299032bytes sample#hit-rate=1 sample#evicted-keys=0
2017-09-08T11:55:30.437885+00:00 app[web.1]: 2017-09-08 20:55:30,437 ERROR    Error trying to receive messages: NOAUTH Authentication required.
2017-09-08T11:55:35.439587+00:00 app[web.1]: 2017-09-08 20:55:35,439 ERROR    Error trying to receive messages: NOAUTH Authentication required.
2017-09-08T11:55:40.441760+00:00 app[web.1]: 2017-09-08 20:55:40,441 ERROR    Error trying to receive messages: NOAUTH Authentication required.
2017-09-08T11:55:45.443072+00:00 app[web.1]: 2017-09-08 20:55:45,442 ERROR    Error trying to receive messages: NOAUTH Authentication required.
2017-09-08T11:55:50.444948+00:00 app[web.1]: 2017-09-08 20:55:50,444 ERROR    Error trying to receive messages: NOAUTH Authentication required.
2017-09-08T11:55:55.446645+00:00 app[web.1]: 2017-09-08 20:55:55,446 ERROR    Error trying to receive messages: NOAUTH Authentication required.
2017-09-08T11:56:00.449178+00:00 app[web.1]: 2017-09-08 20:56:00,448 ERROR    Error trying to receive messages: NOAUTH Authentication required.
2017-09-08T11:56:05.450944+00:00 app[web.1]: 2017-09-08 20:56:05,450 ERROR    Error trying to receive messages: NOAUTH Authentication required.
2017-09-08T11:56:10.452898+00:00 app[web.1]: 2017-09-08 20:56:10,452 ERROR    Error trying to receive messages: NOAUTH Authentication required.
2017-09-08T11:56:15.456223+00:00 app[web.1]: 2017-09-08 20:56:15,456 ERROR    Error trying to receive messages: NOAUTH Authentication required.
2017-09-08T11:56:20.457782+00:00 app[web.1]: 2017-09-08 20:56:20,457 ERROR    Error trying to receive messages: NOAUTH Authentication required.
2017-09-08T11:56:25.459987+00:00 app[web.1]: 2017-09-08 20:56:25,459 ERROR    Error trying to receive messages: NOAUTH Authentication required.
2017-09-08T11:56:30.461919+00:00 app[web.1]: 2017-09-08 20:56:30,461 ERROR    Error trying to receive messages: NOAUTH Authentication required.
2017-09-08T11:56:08+00:00 app[heroku-redis]: source=REDIS sample#active-connections=2 sample#load-avg-1m=0.305 sample#load-avg-5m=0.24 sample#load-avg-15m=0.17 sample#read-iops=0 sample#write-iops=0 sample#memory-total=15664264kB sample#memory-free=11911660kB sample#memory-cached=961060kB sample#memory-redis=299032bytes sample#hit-rate=1 sample#evicted-keys=0
2017-09-08T11:56:35.463998+00:00 app[web.1]: 2017-09-08 20:56:35,463 ERROR    Error trying to receive messages: NOAUTH Authentication required.
2017-09-08T11:56:40.466396+00:00 app[web.1]: 2017-09-08 20:56:40,466 ERROR    Error trying to receive messages: NOAUTH Authentication required.
2017-09-08T11:56:45.467830+00:00 app[web.1]: 2017-09-08 20:56:45,467 ERROR    Error trying to receive messages: NOAUTH Authentication required.
2017-09-08T11:56:50.469777+00:00 app[web.1]: 2017-09-08 20:56:50,469 ERROR    Error trying to receive messages: NOAUTH Authentication required.
2017-09-08T11:56:55.471533+00:00 app[web.1]: 2017-09-08 20:56:55,471 ERROR    Error trying to receive messages: NOAUTH Authentication required.

在各种错误中,NOAUTH 需要身份验证脱颖而出。

我怎么了?我想知道我是否正确设置了重要文件(asgi.py, wsgi.py, settings.py, manage.py, Procfile)。

你能看看那些文件吗?我留下了我的项目 github 存储库。

URL : github.com/juhyun16/multichat

多聊天/asgi.py,wsgi.py

设置/dev.py,prod.py,settings.py

manage.py,Procfile

如果设置没有问题,那么问题出在哪里?非常感谢您的帮助。ps)我的声誉低于10。所以我不能发布超过2个链接。抱歉给您带来不便。

答案1

您是否像这样在 Django 设置中更新了缓存配置?

CACHES = {
    'default': {
                'BACKEND': 'redis_cache.RedisCache',
                'LOCATION': 'ec2-55-55-55-55.compute-1.amazonaws.com:28949',
    'OPTIONS': {
                'DB': 0,
                'PASSWORD': 'pc418888t78768768768633ab425'
                }
    }
}

相关内容