ruby-on-rails - 我可以在 Heroku 上使用 Amazon Elasticache 吗?

标签 ruby-on-rails heroku memcached amazon-elasticache

我目前在 Rails 3 应用程序中使用 Heroku 的 Memcached,并希望转移到 Elasticache,因为价格更优惠。这可能吗?配置是不是比较简单?关于性能,有什么我应该注意的吗?

最佳答案

危险:我不建议将此解决方案用于生产用途。虽然这确实有效,但@btucker 指出它允许任何 Heroku 托管的应用程序访问您的 ElastiCache 集群。

是的,你可以。设置类似于 Heroku 在 Amazon RDS 上的指南。 .不同的步骤是这样的:

  • 按照“Get Started with Amazon ElastiCache”指南创建缓存集群和节点
  • 安装 ElastiCache Command Line Toolkit
  • 允许 Heroku 的服务器进入您的 ElastiCache 集群,如 RDS 指南所述,但替换 rds-带有 elasticache- 的命令那些:
    elasticache-authorize-cache-security-group-ingress \
      --cache-security-group-name default \ 
      --ec2-security-group-name default \
      --ec2-security-group-owner-id 098166147350 \
    
      # If your AWS_CREDENTIAL_FILE environment setting is configured,
      # this option is not necessary.
      --aws-credential-file ../credential-file-path.template
    
  • 使用集群的主机名为您的生产应用程序设置 Heroku 配置值:
    heroku config:set MEMCACHE_SERVERS=elasticachehostname.amazonaws.com
    

  • 之后,关注 Memcache Rails setup ,你就准备好了。

    关于ruby-on-rails - 我可以在 Heroku 上使用 Amazon Elasticache 吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11042794/

    相关文章:

    ruby-on-rails - 在 Windows 7 上使用来自 ruby​​ 的 wicked_pdf 的权限被拒绝

    Herkou "lacks instrumentation functions"上的PostgreSQL

    python - 你如何在 Heroku 上使用 APScheduler 安排 cron 作业?

    php - (PHP) 选择 memcache::connect 还是 memcache::pconnect?

    C# 架构建议 : method to cache data in a structure?

    ruby-on-rails - 使用 find_or_create_by 创建一个包含嵌套对象的对象

    ruby-on-rails - 设计:让用户以两种方式登录

    php - 链接到 Docker memcached 容器

    ruby-on-rails - 将大量美元值输入到 Rails 货币对象中

    node.js - 无法将我的 Node.js 应用程序推送到 Heroku