简体   繁体   English

如何获得Vanity连接到Elasticache实例

[英]How do I get Vanity to connect to Elasticache instance

I am using the Vanity gem to do A/B testing and it works great locally. 我正在使用Vanity gem进行A / B测试,并且在本地效果很好。

On our EC2 instances rails refuses to start when Vanity is enabled. 在我们的EC2实例上,启用Vanity后,rails拒绝启动。

I have been able to recreate the issue locally by providing incorrect details for my local Redis install. 通过为我的本地Redis安装提供错误的详细信息,我能够在本地重新创建问题。

I have tried several permutations of settings, the two that I would have expected to work are; 我已经尝试了几种设置的排列方式,而我原本希望的两种设置是:

staging:
  adapter: redis
  connection: redis://my-name.id.0001.use1.cache.amazonaws.com:6379/0

And

staging:
  adapter: redis
  connection: redis://my-name.id.0001.use1.cache.amazonaws.com:6379

When I log onto the server I can run redis-cli -h my-name.id.0001.use1.cache.amazonaws.com and it connects immediately. 登录服务器后,我可以运行redis-cli -h my-name.id.0001.use1.cache.amazonaws.com ,它会立即连接。

I am pretty sure this should work because this person was able to get something working with a Heroku setup (which just uses an external URL as I used above) 我很确定这应该可行,因为此人可以通过Heroku设置(使用上面我使用的外部URL)获得一些信息

Error Message 错误信息

Here is the error message I get when deploying the server. 这是部署服务器时收到的错误消息。 job_options.rb is my test experiment, it works fine in Development. job_options.rb是我的测试实验,在Development中工作正常。

/shared/bundle/ruby/2.2.0/gems/vanity-2.0.0/lib/vanity/experiment/base.rb:24:in `eval'
/shared/bundle/ruby/2.2.0/gems/vanity-2.0.0/lib/vanity/experiment/base.rb:24:in `block in load'
/shared/bundle/ruby/2.2.0/gems/vanity-2.0.0/lib/vanity/experiment/base.rb:22:in `instance_eval'
/shared/bundle/ruby/2.2.0/gems/vanity-2.0.0/lib/vanity/experiment/base.rb:22:in `load'
/shared/bundle/ruby/2.2.0/gems/vanity-2.0.0/lib/vanity/playground.rb:248:in `block in set_experiments'
/shared/bundle/ruby/2.2.0/gems/vanity-2.0.0/lib/vanity/playground.rb:247:in `each'
/shared/bundle/ruby/2.2.0/gems/vanity-2.0.0/lib/vanity/playground.rb:247:in `set_experiments'
/shared/bundle/ruby/2.2.0/gems/vanity-2.0.0/lib/vanity/playground.rb:26:in `initialize'
/shared/bundle/ruby/2.2.0/gems/vanity-2.0.0/lib/vanity/vanity.rb:133:in `new'
/shared/bundle/ruby/2.2.0/gems/vanity-2.0.0/lib/vanity/vanity.rb:133:in `load!'
/shared/bundle/ruby/2.2.0/gems/vanity-2.0.0/lib/vanity/vanity.rb:123:in `playground'
/shared/bundle/ruby/2.2.0/gems/vanity-2.0.0/lib/vanity/adapters/redis_adapter.rb:219:in `rescue in call_redis_with_failover'
/shared/bundle/ruby/2.2.0/gems/vanity-2.0.0/lib/vanity/adapters/redis_adapter.rb:216:in `call_redis_with_failover'
/shared/bundle/ruby/2.2.0/gems/vanity-2.0.0/lib/vanity/adapters/redis_adapter.rb:105:in `set_experiment_created_at'
/shared/bundle/ruby/2.2.0/gems/vanity-2.0.0/lib/vanity/experiment/base.rb:159:in `save'
/shared/bundle/ruby/2.2.0/gems/vanity-2.0.0/lib/vanity/experiment/ab_test.rb:451:in `save'
/shared/bundle/ruby/2.2.0/gems/vanity-2.0.0/lib/vanity/experiment/definition.rb:21:in `define'
/shared/bundle/ruby/2.2.0/gems/vanity-2.0.0/lib/vanity/experiment/ab_test.rb:571:in `ab_test'
./experiments/job_options.rb:1:in `new_binding'

Looks like this was a regression in Vanity 2.0, until a fix is released, you can just replace the connection key in the Vanity config with a url key, eg: 看起来这是Vanity 2.0中的回归,直到发布修复程序为止,您只需用url键替换Vanity配置中的connection键即可,例如:

staging:
  adapter: redis
  url: redis://my-name.id.0001.use1.cache.amazonaws.com:6379/0

Those keys are passed through to the individual adapters and the ruby Redis client accepts url . 这些密钥被传递到各个适配器,并且ruby Redis客户端接受url

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM