ruby-on-rails - Heroku 上多个 Redis 实例的最佳实践?

标签 ruby-on-rails heroku

我正计划向我的 Rails 应用程序添加第二个 Redis 实例。通过阅读文档,https://devcenter.heroku.com/articles/heroku-redis#establish-the-primary-instance ,在 Heroku 上执行此操作的最佳做​​法似乎是将其中一个实例指定为“主要”实例,使用 REDIS_URL 配置变量指向它,并使用其他名称的另一个配置变量指向第二个实例。

这不太适合我,因为我想使用更多语义名称。

将我的其中一个实例指定为“主要”有多重要?我这样做有什么好处?文档包含诸如“Heroku 建议使用 REDIS_URL 配置变量来存储主实例的位置”之类的句子,但没有进一步详细说明。

最佳答案

REDIS_URL 没有什么神奇之处。支持:

While Heroku recommends to establish a single data store service as a primary and some tools are built around this convention, it is surely possible to have more than one data services with other config var names.

To specify a semantic name for the config var, please add an --as option to the addon:create command like so:

heroku addons:create heroku-redis --as PERSISTENT_REDIS -a my-heroku-app

Moreover, an existing add-on can be attached through a different config var like below. Please refer to the output from the heroku addons command to see what is the add-on name (redis-abc-1234 in the example below) to be used.

heroku addons:attach redis-abc-1234 --as VOLATILE_REDIS -a my-heroku-app

关于ruby-on-rails - Heroku 上多个 Redis 实例的最佳实践?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45201704/

相关文章:

ruby-on-rails - Ruby on Rails OmniAuth Facebook 适用于 Heroku 上的 Live App 但不适用于 Cloud9 上的测试应用

heroku 客户端内部错误 - 控制台超时

ruby - IMAP 空闲如何工作?

javascript - Axios Api 在 Heroku 中调用

python - Heroku 上的 Django 不允许我创建 super 用户

ruby-on-rails - rails 上的 ruby : Yielding specific views in a specific places in the layout

ruby-on-rails - 捆绑更新然后 sprockets 抛出 filenotfound 错误 rails 3.2.3 ruby​​1.9.3p194

ruby-on-rails - 我如何在没有控制台的情况下关闭Rails服务器?

ruby-on-rails - Rails - 检测到急切加载

Mysql2::错误:表.schema_migrations'不存在