我有在aws上运行的django 2.2应用程序,它在aws elasticache上与Memcached一起正常工作,但是由于某些原因,它不会连接到aws elasticache上的redis服务器。
我已经向我的安全组添加了权限,但是没有成功,http请求只是挂起,直到它超时。
尽管类似的行为通常与安全组有关,但我觉得我可能在.requirements中的Yum.ebextensions包中缺少一些redis特定的包,因为所有东西都在本地正常工作,而且aws上的Memcached服务器也正常工作。
也许,我需要以某种方式启动/启用redis服务器来开始接受连接吗?
这是我有的。
设置.py

CACHES = {
'default': {
    'BACKEND': 'django_redis.cache.RedisCache',
    'LOCATION': 'redis://myendpoint.cache.amazonaws.com:6379',
    'OPTIONS': {
        'CLIENT_CLASS': 'django_redis.client.DefaultClient',
    }
}

}
.ebextensions公司
packages:
    yum:
        python36-devel: []
        mysql-devel: []
        libmemcached-devel: []
        gcc: []
        gcc-c++: []
        libffi-devel: []

option_settings:
    aws:elasticbeanstalk:application:environment:
        DJANGO_SETTINGS_MODULE: "api.settings"

需求.txt
blessed==1.15.0
botocore==1.12.137
cached-property==1.5.1
cement==2.8.2
certifi==2019.3.9
chardet==3.0.4
colorama==0.3.9
django-redis==4.10.0
Django==2.2.1
djangorestframework==3.9.2
docutils==0.14
future==0.16.0
future==0.16.0
idna==2.7
jmespath==0.9.4
jsonschema==2.6.0
mysqlclient==1.4.2.post1
pathspec==0.5.9
python-dateutil==2.8.0
python-memcached==1.59
pytz==2019.1
PyYAML==3.13
redis==3.2.1
requests==2.20.1
semantic-version==2.5.0
six==1.11.0
sqlparse==0.3.0
termcolor==1.1.0
texttable==0.9.1
urllib3==1.24.2
wcwidth==0.1.7
websocket-client==0.56.0

最佳答案

所有支持的django redis版本都依赖于redis py>=2.10.0
django-redis documentation

关于python - Django 2.2无法连接到AWS ElasticBeanstalk上的ElastiCache Redis,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/55935568/

10-11 03:40
查看更多