如何在 microsoft azure 上的 django 项目中配置 celery-redis? [英] How to configure celery-redis in django project on microsoft azure?
问题描述
我在 azure 中部署了这个 django 定位器项目.我的 redis 缓存主机名 (DNS) 是 mycompany.azure.microsoft.net.我在 azure 中创建了它,但不确定在哪里可以找到 redis 服务器的密码.我在 settings.py 中将此作为我的配置.我在项目中使用 redis 作为我的 celery 设置的代理.
I have this django locator project deployed in azure. My redis cache host name(DNS) is mycompany.azure.microsoft.net. I created it in azure, but not sure where i can find the password for the redis server. I have got this as my configuration in my settings.py. I am using redis as a broker for my celery setup in project.
BROKER_URL = 'redis://:passwordAzureAccessKey=@mycompany.redis.cache.windows.net:6380/0'
我无法连接.有什么不同的,我需要输入密码或用户名才能连接到上面的服务器吗?另外我在哪里可以找到 Azure 中的密码.还是因为我试图从本地主机联系 Azure redis?
I could not connect. Is there anyplace different, I need to put password or username to connect to the above server ? Also where can i find the password in Azure. Or is it due to the fact that I am trying to contact the Azure redis from localhost ?
推荐答案
你可以在Azure门户中找到你的redis服务密钥,点击设置=>访问密钥,你可以在 redis 连接字符串中选择主键或辅助键作为密码.
You can find your redis services keys in Azure portal, click Settings=>Access keys, you can select either primary or secondary key as your password in the redis connection string.
此外,您可以尝试启用 redis 服务的非 ssl 端点,如https://azure.microsoft.com/en-us/documentation/articles/cache-python-get-started/#启用非 SSL 端点.
And addtionally, you can try to enable the non-ssl endpoint of your redis service, as mentioned at https://azure.microsoft.com/en-us/documentation/articles/cache-python-get-started/#enable-the-non-ssl-endpoint.
看来你使用的是celery
,你可以使用celery cli 命令来测试你的redis 服务.E.G.
It seems that you are using celery
, you can use celery cli command to test your redis serivice. E.G.
celery inspect ping -b redis://:{password}@{redis_service_name}.redis.cache.windows.net:6379/0
这篇关于如何在 microsoft azure 上的 django 项目中配置 celery-redis?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!