如何在波动的Django服务器的AWS EC2实例管理的memcached集群 [英] How to manage memcached cluster across fluctuating aws ec2 instances of django servers

查看:243
本文介绍了如何在波动的Django服务器的AWS EC2实例管理的memcached集群的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Django中,集群的memcached节点,一个非常简单的方法被使用。简单地列出所有节点地址在所有你的Django的服务器,像这样的settings.py文件:

In Django, to cluster memcached nodes, a very simple method is used. Simply list all node address in the settings.py file of all your django servers like so:

CACHES = {
    'default': {
        'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
        'LOCATION': [
            'xxx.xxx.xxx.240:11211',
            'xxx.xxx.xxx.242:11211',
            ...,
        ]
    }
}

显然,编辑每个实例的setting.py文件每当一个实例滴出或新加入将是痛苦的,你会怎么去自动地管理增加新的节点群集?

Obviously editing the setting.py file of each instance whenever an instance drops out or a new one is added would be painful, how would you go about automagically managing the addition of new nodes to the cluster?

  • 在所有情况下都在负载平衡器。

可能不回答:

  • 我也可以只选择其中一个Django的实例运行的memcached 由于我只使用memcached的存储微小标记单个节点。 但是,我们的目标是让所有的EC2实例是相同的。
  • 我也可以使用elasticache,但它是昂贵(35块钱/月!:) )的最小版本
  • I could also just dedicate one django instance to run a memcached single node since I am only using memcached to store tiny tokens. But the goal is to have all ec2 instances be identical.
  • I could also use elasticache but it is expensive (35 bucks/month! :) ) for the smallest version

请注意: 我使用memcached到prevent celeryd人员访问相同的资源,但它的确定,如果偶尔资源是双访问。而我的令牌有一个寿命很短(小于15秒)。所以失去memcached的节点不是什么大不了的事,只要它不发生过于频繁。

Note: I use memcached to prevent celeryd workers from accessing the same resources, but its ok if occasionally a resource is double accessed. And my tokens have a short lifespan (less than 15 seconds). So loosing memcached nodes is not a big deal as long as it doesn't happen too frequently.

推荐答案

如果您的缓存数据真的是非常小的,也许你会感兴趣像redistogo.com非亚马逊的托管缓存服务。他们有一个免费的版本,如果你的数据是足够小,计价秤非常非常合理的。

If your cache data really is very small, maybe you'd be interested in a non-amazon hosted cache service like redistogo.com. They have a free version if your data is small enough and the pricing scales very very reasonably.

这不回答你的问题在​​所有,但既然你提到elasticache但犹豫不决的价格,也许它会满足您的需求。

This doesn't answer your question at all, but since you mentioned elasticache but balked at the price, maybe it will fit your needs.

这篇关于如何在波动的Django服务器的AWS EC2实例管理的memcached集群的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆